TrustApplySupplementBiz.java 1.64 KB
package com.cjs.cms.biz.ration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cjs.cms.dao.ration.OtcTrustEECodeDao;
import com.cjs.cms.dao.ration.TrustApplySupplementDao;
import com.cjs.cms.model.ration.OtcTrusteeCodeInfo;
import com.cjs.cms.model.ration.TrustApplySupplementInfo;
import com.cjs.cms.util.lang.JsonUtil;

/**
 * 补货托管
 * 
 * @author tongyufu
 *
 */
@Service
public class TrustApplySupplementBiz {

    @Autowired
    private OtcTrustEECodeDao       otcTrustEECodeDao;
    @Autowired
    private TrustApplySupplementDao trustApplySupplementDao;

    /**修改入库总量*/
    @Transactional
    public String updateTotalAmount(OtcTrusteeCodeInfo otcTrusteeCodeInfo, String createBy) {
        OtcTrusteeCodeInfo old = otcTrustEECodeDao.queryByOtcCode(otcTrusteeCodeInfo.getOtcCode());
        otcTrustEECodeDao.updateTotalAmount(otcTrusteeCodeInfo);

        TrustApplySupplementInfo supplement = new TrustApplySupplementInfo();
        supplement.setOtcCode(old.getOtcCode());
        supplement.setOtcName(old.getOtcName());
        supplement.setBusinessFlag("2");
        supplement.setApplyNo("");
        supplement
            .setOccurAmount(otcTrusteeCodeInfo.getApplicableAmount() - old.getApplicableAmount());
        supplement.setPostAmount(otcTrusteeCodeInfo.getApplicableAmount());
        supplement.setCreateBy(createBy);
        supplement.setRemark(otcTrusteeCodeInfo.getRemark());
        trustApplySupplementDao.save(supplement);
        return JsonUtil.toFormJson("修改成功", true);
    }
}