/***文档注释***********************************************
 * 作者               :                  
 * 创建日期      :                   2019.02.24
 * 描述               :                   物流和质量模块调用的公共接口
 * 注意事项      :                    无
 * 遗留BUG :                     无
 * 修改日期      :                   
 * 修改人员      :                   
 * 修改内容      :                   
 ***********************************************************/

package market.Api.Lms.impl;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import market.Api.Lms.service.LmsMesApiService;
import market.Com.mapper.ComBaseMachineMapper;
import market.Com.vo.ComBaseMachine;
import market.Com.vo.CommonPage;
import market.Com.vo.ResultModel;
import market.Lms.Warehouse.mapper.YdmProductDetailMapper;
import market.Lms.Warehouse.vo.YdmProductDetail;
import market.Mes.Lengthwise.Plan.mapper.PlnMatReplaceLogMapper;
import market.Mes.Lengthwise.Plan.vo.PlnMatReplaceLog;
import market.Mes.OrderManager.Plan.mapper.PlnProdorderMapper;
import market.Mes.OrderManager.Plan.vo.PlnProdorder;
import market.Mes.Pickle.Performance.mapper.MesPlmMMapper;
import market.Mes.Pickle.Performance.vo.MesPlmD;
import market.Mes.Pickle.Performance.vo.MesPlmM;
import market.Mes.Rolling.Performance.mapper.MesRcmMMapper;
import market.Mes.Rolling.Performance.vo.MesRcmD;
import market.Mes.Rolling.Performance.vo.MesRcmM;
import market.Slm.OrderManagement.mapper.SlmOrderInfoMapper;
import market.Slm.OrderManagement.vo.SlmOrderInfo;

import com.hnshituo.basic.service.impl.BaseServiceImpl;
import com.hnshituo.basic.spring.remoting.annotation.RemoteService;
import com.hnshituo.core.auth.service.HomeService;

@RemoteService(path="LmsMesApiService")
public class LmsMesApiServiceImpl extends BaseServiceImpl<Object,Object> implements LmsMesApiService {
	
	/**
	 * 轧机新增库存数据
	 * @param cp
	 * @return
	 * @throws Exception
	 */
	public ResultModel doInsertMesRcm(CommonPage<MesRcmD> cp) throws Exception {
		ResultModel rm=new ResultModel();

		MesRcmD mtd = cp.getObject(); 
		MesRcmM mtm=new MesRcmM();//轧机生产主实绩
		mtm.setProcess_no(mtd.getProcess_no());
		List<MesRcmM> list_mtm = this.getMapper(MesRcmMMapper.class).find(mtm, 0, 0);
		if(list_mtm==null || list_mtm.size()<=0){
			rm.setState("500");
			rm.setMsgInfo("不存在生产主实绩，请重新进行上料操作！");
			return rm;
		}
		mtm=list_mtm.get(0);
		String username=(String) this.getSession().getAttribute(HomeService.SESSION_USER_NAME);
		
		try { 
			if (mtd==null || mtd.getCoil_no()==null || "".equals(mtd.getCoil_no())) {
				rm.setState("500");
				rm.setMsgInfo("请传入卷号！");
				return rm;
			}
			//1.判断是否已经存在库存信息
			YdmProductDetail YPD = new YdmProductDetail();
			if ("0".equals(cp.getMemo5())) {//吊销卷号
				YPD.setCoilno(mtm.getRejected_coil_no());
			}
			YPD.setCoilno(mtd.getCoil_no());
			int count = this.getMapper(YdmProductDetailMapper.class).count(YPD);
			if (count > 0) {
				rm.setState("500");
				rm.setMsgInfo("卷号["+YPD.getCoilno()+"]已存在库存数据！");
				return rm;
			}
			
			YdmProductDetail ypd = new YdmProductDetail();
			//ypd.setCoilno(mtm.getCoil_no());
			//ypd.setCoiltype("?");//卷类别(0原料卷、1中间卷、2成品卷)
			//原料卷类型（1酸洗卷、2酸轧卷、3连退卷、4重卷卷、0其它卷）					
			List<YdmProductDetail> list = this.getMapper(YdmProductDetailMapper.class).findWithCondition(null, "coilno ='"+mtm.getMaterial_no()+"'", null, 0, 0);
			if(list!=null && list.size()>0){
				ypd.setMaterailtype(list.get(0).getMaterailtype());
				ypd.setHeatno(list.get(0).getHeatno());//将原料卷的炉号带入分条退火信息
			}
			ypd.setSource("0");//原料卷来源（0新钢、1其它）
			
			if (mtm.getMachine_code()!=null && !"".equals(mtm.getMachine_code())) {
				ypd.setMachine_code(mtm.getMachine_code());//机台号代码
				ComBaseMachine machine = this.getMapper(ComBaseMachineMapper.class).findById(mtm.getMachine_code());
				if (machine!=null) {
					ypd.setMachine_name(machine.getMachine_name());//机台号名称
				}
			}
			ypd.setMaterailcoilno(mtm.getMaterial_no_src());//原始卷号
			ypd.setObject_no_vt(mtd.getCoil_no_vt());						
			
			
			
			if ("0".equals(cp.getMemo5())) {
				//吊销卷号
				ypd.setCoilno(mtm.getRejected_coil_no());//吊销卷号
				ypd.setTheoryweight(mtm.getRejected_coil_thr_wgt());//吊销卷理重
				ypd.setFactweight(mtm.getRejected_coil_act_wgt());//吊销卷实重
				ypd.setLength(mtm.getRejected_coil_len());//吊销卷长度
				ypd.setDiameter_out(mtm.getRejected_coil_out_dia());//吊销卷外径
			}else{
				//产出卷号
				ypd.setCoilno(mtd.getCoil_no());
				ypd.setThick(mtd.getAct_thk());
				ypd.setWidth(mtd.getAct_wdt());
				ypd.setLength(mtd.getAct_len());
				//20191018:包括目标宽度，目标厚度到库存表
				ypd.setLz_thick(mtd.getAim_thk());//合同厚度(目标厚度)
				ypd.setLz_width(mtd.getAim_wdt());//合同宽度(目标宽度)
				ypd.setDiameter_inn(mtd.getAct_inn_dia());
				ypd.setDiameter_out(mtd.getAct_out_dia());
				ypd.setTheoryweight(mtd.getCoil_thr_wgt());
				ypd.setFactweight(mtd.getCoil_act_wgt());
				ypd.setProdorderno(mtd.getProd_order_no());
				ypd.setOrderno(mtd.getOrder_no());
				ypd.setInspection_lot(mtd.getInspection_lot());
				if(mtd.getProd_order_no()!=null && !"".equals(mtd.getProd_order_no())){
					//生产订单信息
					PlnProdorder pp=new PlnProdorder();
					pp.setProd_order_no(mtd.getProd_order_no());
					List<PlnProdorder> lpp=this.getMapper(PlnProdorderMapper.class).find(pp, 0, 1);
					if(lpp!=null&&lpp.size()>0){
						pp = lpp.get(0);
						ypd.setCustomer_no(pp.getCustomer_no());
						ypd.setCustomer_nm(pp.getCustomer_name());
						ypd.setPsc(pp.getPsc());
						ypd.setDelivery_state_code(pp.getDelivery_state_code());//交货状态
						ypd.setDelivery_state_desc(pp.getDelivery_state_desc());
						ypd.setProd_code(pp.getProd_code());
						ypd.setProd_name(pp.getProd_name());
						ypd.setStd_code(pp.getStd_code());
						ypd.setStd_name(pp.getStd_name());
						ypd.setUse_code(pp.getUse_code());
						ypd.setUse_name(pp.getUser_name());
						ypd.setPlan_code(pp.getPline_code());
						ypd.setPline_name(pp.getPline_name());
						ypd.setSteelcode(pp.getSteel_code());
						ypd.setReceiv_no(pp.getReciver_unit_no());
						ypd.setReceiv_nm(pp.getReciver_unit_name()); 
					}
				}
			}
			
			ypd.setCreater(username);
			ypd.setCreatedate(new Date()); 
			
			ypd.setSteelcode(mtd.getSteel_code());
			
			// 改为获取投料卷信息里的判定牌号：20240722刘侣 改回来不动 20240815
			ypd.setJudgesteelcode(mtd.getSteel_code());	
//			ypd.setJudgesteelcode(list.get(0).getJudgesteelcode());	
			
			//20200807 :易XP XG130QR(1173) 经过轧机 自动转换成 XG130Q(1204)
			if ("1173".equals(mtd.getSteel_code())) {
				ypd.setSteelcode("1204");
				ypd.setJudgesteelcode("1204");
			}
			ypd.setProduceorder(mtd.getWrk_ord());//作业班次 --》生产班次
			ypd.setProduceteam(mtd.getWrk_grp());//作业班组 --》生产班组
			if (mtd.getWrk_date()!=null && !"".equals(mtd.getWrk_date())) {
				ypd.setProducedate(new Date());		
			}
			//ypd.setProducedate(mtd.getCreate_time());					
			ypd.setState("-1"); 
			ypd.setStorageattr(cp.getMemo1());//仓库编码
			ypd.setCoiltype("500203".equals(ypd.getStorageattr())?"2":"1");
			ypd.setManagementno(cp.getMemo2());//部门
			
			ypd.setQuantity(1);
			ypd.setBatchno(mtm.getSchedule_no());
			ypd.setObject_no_xg("");
			ypd.setInteam((String)this.getSession().getAttribute(HomeService.SESSION_WORK_GRP));
			ypd.setInorder((String)this.getSession().getAttribute(HomeService.SESSION_WORK_ORD));
			
			if (mtd.getCoil_no().length() >= 8) { 
				//String coco = mtd.getCoil_no().substring(0,8);
				YdmProductDetail yyd=new YdmProductDetail();
				yyd = this.getMapper(YdmProductDetailMapper.class).doFind(mtm.getMaterial_no(), null);
				if(yyd!=null){
					if(yyd.getMaterailcoilno()!=null&&!"".equals(yyd.getMaterailcoilno())){
						ypd.setMaterailcoilno(yyd.getMaterailcoilno());//原料卷号
					}
					if(yyd.getObject_attr()!=null&&!"".equals(yyd.getObject_attr())){
						ypd.setObject_attr(yyd.getObject_attr());//物料属性
					}
					//物料属性
					if(cp.getMemo3()!=null && !"".equals(cp.getMemo3())){
						ypd.setObject_attr(cp.getMemo3());
						ypd.setIsbl("1");
					}
					
					if(yyd.getLzorderno()!=null&&!"".equals(yyd.getLzorderno())){
						ypd.setLzorderno(yyd.getLzorderno());//冷轧销售订单号
					}
				} 
			}
			//20190801 边丝和头尾卷默认综判判废//20191025 进废副品库
			String lastChar = ypd.getCoilno().substring(ypd.getCoilno().length()-1);
			if ("B".equals(lastChar) || "H".equals(lastChar)) {
				ypd.setJudgeresult("40740804");
				//20200317 净重的头尾卷及边丝入废钢库  毛重进成品库 黄涛提出
				String condition = "contract_no||contract_line_seq||order_seq = '"+ypd.getOrderno()+"' and nvl(change_flag,'0')<>'1'";
				List<SlmOrderInfo> soiList = this.getMapper(SlmOrderInfoMapper.class).findWithCondition(null, condition, null, 0, 0);
				if (soiList!=null && soiList.size()>0) {
					String weight_type_no = soiList.get(0).getWeight_type_no();
					if ("102301".equals(weight_type_no)) {//净重
						
						// 净重的头尾卷和边丝脱单后需要手动插入脱单信息：20230725刘侣
						// 前提是这个卷没有做过脱单插入：
						
						String conditiontd = " and OBJECT_NO = '"+ypd.getCoilno()+"' and OPT_TYPE = '0'";
						List<PlnMatReplaceLog> pmrList = this.getMapper(PlnMatReplaceLogMapper.class).findWithCondition(null, conditiontd, null, 0, 0);
						if (pmrList.size() == 0) {
							List<PlnMatReplaceLog> lmmrl = this.getMapper(PlnMatReplaceLogMapper.class).findWithCondition(null, "",
									" serial_no desc ", 0, 1);
							long iNo = 1;
							if (lmmrl != null && lmmrl.size() > 0) {
								iNo = lmmrl.get(0).getSerial_no() + 1;
							}
							PlnMatReplaceLog mmrl = new PlnMatReplaceLog();
							mmrl.setSerial_no(iNo++);
							mmrl.setObject_no(ypd.getCoilno());
							mmrl.setOpt_type("0");
							mmrl.setStatus("0");
							mmrl.setOrder_no(ypd.getOrderno());
							
							mmrl.setCreate_man_name(username);
							mmrl.setCreate_time(new Date());
							mmrl.setMemo("净重头尾边丝卷补脱单信息");
							this.getMapper(PlnMatReplaceLogMapper.class).insert(mmrl);
						}
						
						// end
						
						
						ypd.setStorageattr("500210");
						ypd.setOrderno("");
						ypd.setProdorderno("");
						ypd.setObject_no_vt("");
					}else if ("102302".equals(weight_type_no)) {//毛重
						ypd.setStorageattr("500203");
						// 毛重头尾边丝默认合格：20231024刘侣
						ypd.setJudgeresult("40740801");
					}
				}
			} else {
				// 非边丝非头尾：如果memo7为1，那么需要二次切头尾 20220802 treals
				// 只有大卷才需要二次切头尾：
//				if ("1".equals(cp.getMemo7())) {
//					ypd.setYsstate("1");
//				}
				// end
			}
			//包装状态(20191016)
			ypd.setIs_package("0");
			this.getMapper(YdmProductDetailMapper.class).insert(ypd);
		} catch (Exception e) {
			rm.setState("500");
			rm.setMsgInfo("新增库存数据失败！");
			return rm;
		}
		rm.setState("200");
		return rm; 
	}
		
	/**
	 *  酸洗交工新增库存数据
	 * @param cp
	 * @return
	 * @throws Exception
	 */
	public ResultModel doInsertMesPlm(CommonPage<MesPlmD> cp) throws Exception {
		ResultModel rm=new ResultModel();

		MesPlmD mpd = cp.getObject(); 
		MesPlmM mpm=new MesPlmM();//酸洗生产主实绩
		mpm.setProcess_no(mpd.getProcess_no());
		List<MesPlmM> list_mpm = this.getMapper(MesPlmMMapper.class).find(mpm, 0, 0);
		if(list_mpm==null || list_mpm.size()<=0){
			rm.setState("500");
			rm.setMsgInfo("不存在酸洗生产主实绩，请重新进行上料操作！");
			return rm;
		}
		mpm=list_mpm.get(0);
		String username=(String) this.getSession().getAttribute(HomeService.SESSION_USER_NAME);
		try { 
			if (mpd==null || mpd.getCoil_no()==null || "".equals(mpd.getCoil_no())) {
				rm.setState("500");
				rm.setMsgInfo("请传入卷号！");
				return rm;
			}
			//1.判断是否已经存在库存信息
			YdmProductDetail YPD = new YdmProductDetail();
			if ("0".equals(cp.getMemo5())) {//吊销卷号
				YPD.setCoilno(mpm.getRejected_coil_no());
			}
			YPD.setCoilno(mpd.getCoil_no());
			int count = this.getMapper(YdmProductDetailMapper.class).count(YPD);
			if (count > 0) {
				rm.setState("500");
				rm.setMsgInfo("卷号["+YPD.getCoilno()+"]已存在库存数据！");
				return rm;
			}
			
			YdmProductDetail ypd = new YdmProductDetail();
			//ypd.setCoilno(mpm.getCoil_no());
			//ypd.setCoiltype("?");//卷类别(0原料卷、1中间卷、2成品卷)
			//原料卷类型（1酸洗卷、2酸轧卷、3连退卷、4重卷卷、0其它卷）					
			List<YdmProductDetail> list = this.getMapper(YdmProductDetailMapper.class).findWithCondition(null, "coilno ='"+mpm.getMaterial_no()+"'", null, 0, 0);
			if(list!=null && list.size()>0){
				ypd.setMaterailtype(list.get(0).getMaterailtype());
				ypd.setHeatno(list.get(0).getHeatno());//将原料卷的炉号带入分条退火信息
			}
			ypd.setSource("0");//原料卷来源（0新钢、1其它）
			
			if (mpm.getMachine_code()!=null && !"".equals(mpm.getMachine_code())) {
				ypd.setMachine_code(mpm.getMachine_code());//机台号代码
				ComBaseMachine machine = this.getMapper(ComBaseMachineMapper.class).findById(mpm.getMachine_code());
				if (machine!=null) {
					ypd.setMachine_name(machine.getMachine_name());//机台号名称
				}
			}
			ypd.setMaterailcoilno(mpm.getMaterial_no_src());//原始卷号
			ypd.setObject_no_vt(mpd.getCoil_no_vt());						
			
			
			
			if ("0".equals(cp.getMemo5())) {
				//吊销卷号
				ypd.setCoilno(mpm.getRejected_coil_no());//吊销卷号
				ypd.setTheoryweight(mpm.getRejected_coil_thr_wgt());//吊销卷理重
				ypd.setFactweight(mpm.getRejected_coil_act_wgt());//吊销卷实重
				ypd.setLength(mpm.getRejected_coil_len());//吊销卷长度
				ypd.setDiameter_out(mpm.getRejected_coil_out_dia());//吊销卷外径
			}else{
				//产出卷号
				ypd.setCoilno(mpd.getCoil_no());
				ypd.setThick(mpd.getAct_thk());
				ypd.setWidth(mpd.getAct_wdt());
				ypd.setLength(mpd.getAct_len());
				//20191018:包括目标宽度，目标厚度到库存表
				ypd.setLz_thick(mpd.getAim_thk());//合同厚度(目标厚度)
				ypd.setLz_width(mpd.getAim_wdt());//合同宽度(目标宽度)
				ypd.setDiameter_inn(mpd.getAct_inn_dia());
				ypd.setDiameter_out(mpd.getAct_out_dia());
				//理论重量取实重2020-1-11
				ypd.setTheoryweight(mpd.getCoil_act_wgt()); 
				ypd.setFactweight(mpd.getCoil_act_wgt());
				ypd.setProdorderno(mpd.getProd_order_no());
				ypd.setOrderno(mpd.getOrder_no());
				ypd.setInspection_lot(mpd.getInspection_lot());
				if(mpd.getProd_order_no()!=null && !"".equals(mpd.getProd_order_no())){
					//生产订单信息
					PlnProdorder pp=new PlnProdorder();
					pp.setProd_order_no(mpd.getProd_order_no());
					List<PlnProdorder> lpp=this.getMapper(PlnProdorderMapper.class).find(pp, 0, 1);
					if(lpp!=null&&lpp.size()>0){
						pp = lpp.get(0);
						ypd.setCustomer_no(pp.getCustomer_no());
						ypd.setCustomer_nm(pp.getCustomer_name());
						ypd.setPsc(pp.getPsc());
						ypd.setDelivery_state_code(pp.getDelivery_state_code());//交货状态
						ypd.setDelivery_state_desc(pp.getDelivery_state_desc());
						ypd.setProd_code(pp.getProd_code());
						ypd.setProd_name(pp.getProd_name());
						ypd.setStd_code(pp.getStd_code());
						ypd.setStd_name(pp.getStd_name());
						ypd.setUse_code(pp.getUse_code());
						ypd.setUse_name(pp.getUser_name());
						ypd.setPlan_code(pp.getPline_code());
						ypd.setPline_name(pp.getPline_name());
						ypd.setSteelcode(pp.getSteel_code());
						ypd.setReceiv_no(pp.getReciver_unit_no());
						ypd.setReceiv_nm(pp.getReciver_unit_name()); 
					}
				}
			}
			
			ypd.setCreater(username);
			ypd.setCreatedate(new Date()); 
			
			ypd.setSteelcode(mpd.getSteel_code());
			
			// 改为获取投料卷信息里的判定牌号：20240722刘侣 改回来不动 20240815
			ypd.setJudgesteelcode(mpd.getSteel_code());	
//			ypd.setJudgesteelcode(list.get(0).getJudgesteelcode());	
			
			//20200807 :易XP XG130Q(1204)经过酸洗 自动转换成 XG130QR(1173)
			if ("1204".equals(mpd.getSteel_code())) {
				ypd.setSteelcode("1173");
				ypd.setJudgesteelcode("1173");
			}
			ypd.setProduceorder(mpd.getWrk_ord());//作业班次 --》生产班次
			ypd.setProduceteam(mpd.getWrk_grp());//作业班组 --》生产班组
			//if (mpd.getWrk_date()!=null && !"".equals(mpd.getWrk_date())) {
				//ypd.setProducedate(new SimpleDateFormat("yyyy-MM-dd").parse(mpd.getWrk_date()));
			//}
			ypd.setProducedate(new Date());
			ypd.setState("-1"); 
			ypd.setStorageattr(cp.getMemo1());//仓库编码
			ypd.setCoiltype("500203".equals(ypd.getStorageattr())?"2":"1");
			ypd.setManagementno(cp.getMemo2());//部门
			
			ypd.setQuantity(1);
			ypd.setBatchno(mpm.getSchedule_no());
			ypd.setObject_no_xg("");
			ypd.setInteam((String)this.getSession().getAttribute(HomeService.SESSION_WORK_GRP));
			ypd.setInorder((String)this.getSession().getAttribute(HomeService.SESSION_WORK_ORD));
			
			if (mpd.getCoil_no().length() >= 8) { 
				//String coco = mpd.getCoil_no().substring(0,8);
				YdmProductDetail yyd=new YdmProductDetail();
				yyd = this.getMapper(YdmProductDetailMapper.class).doFind(mpm.getMaterial_no(), null);
				if(yyd!=null){
					if(yyd.getMaterailcoilno()!=null&&!"".equals(yyd.getMaterailcoilno())){
						ypd.setMaterailcoilno(yyd.getMaterailcoilno());//原料卷号
					}
					if(yyd.getObject_attr()!=null&&!"".equals(yyd.getObject_attr())){
						ypd.setObject_attr(yyd.getObject_attr());//物料属性
					}
					//物料属性
					if(cp.getMemo3()!=null && !"".equals(cp.getMemo3())){
						ypd.setObject_attr(cp.getMemo3());
						ypd.setIsbl("1");
					}
					
					if(yyd.getLzorderno()!=null&&!"".equals(yyd.getLzorderno())){
						ypd.setLzorderno(yyd.getLzorderno());//冷轧销售订单号
					}
				} 
			}
			//20190801 边丝和头尾卷默认综判判废//20191025 进废副品库
			String lastChar = ypd.getCoilno().substring(ypd.getCoilno().length()-1);
			if ("B".equals(lastChar) || "H".equals(lastChar)) {
				ypd.setJudgeresult("40740804");
				//ypd.setStorageattr("500210");
				//20200317 净重的头尾卷及边丝入废钢库  毛重进成品库 黄涛提出
				String condition = "contract_no||contract_line_seq||order_seq = '"+ypd.getOrderno()+"' and nvl(change_flag,'0')<>'1'";
				List<SlmOrderInfo> soiList = this.getMapper(SlmOrderInfoMapper.class).findWithCondition(null, condition, null, 0, 0);
				if (soiList!=null && soiList.size()>0) {
					String weight_type_no = soiList.get(0).getWeight_type_no();
					if ("102301".equals(weight_type_no)) {//净重
						
						// 净重的头尾卷和边丝脱单后需要手动插入脱单信息：20230725刘侣
						// 前提是这个卷没有做过脱单插入：
						
						String conditiontd = " and OBJECT_NO = '"+ypd.getCoilno()+"' and OPT_TYPE = '0'";
						List<PlnMatReplaceLog> pmrList = this.getMapper(PlnMatReplaceLogMapper.class).findWithCondition(null, conditiontd, null, 0, 0);
						if (pmrList.size() == 0) {
							List<PlnMatReplaceLog> lmmrl = this.getMapper(PlnMatReplaceLogMapper.class).findWithCondition(null, "",
									" serial_no desc ", 0, 1);
							long iNo = 1;
							if (lmmrl != null && lmmrl.size() > 0) {
								iNo = lmmrl.get(0).getSerial_no() + 1;
							}
							PlnMatReplaceLog mmrl = new PlnMatReplaceLog();
							mmrl.setSerial_no(iNo++);
							mmrl.setObject_no(ypd.getCoilno());
							mmrl.setOpt_type("0");
							mmrl.setStatus("0");
							mmrl.setOrder_no(ypd.getOrderno());
							
							mmrl.setCreate_man_name(username);
							mmrl.setCreate_time(new Date());
							mmrl.setMemo("净重头尾边丝卷补脱单信息");
							this.getMapper(PlnMatReplaceLogMapper.class).insert(mmrl);
						}
						
						// end
						
						
						ypd.setStorageattr("500210");
						ypd.setOrderno("");
						ypd.setProdorderno("");
						ypd.setObject_no_vt("");
					}else if ("102302".equals(weight_type_no)) {//毛重
						ypd.setStorageattr("500203");
						// 毛重头尾边丝默认合格：20231024刘侣
						ypd.setJudgeresult("40740801");
					}
				}
			}
			//包装状态(20191016)
			ypd.setIs_package("0");
			this.getMapper(YdmProductDetailMapper.class).insert(ypd);
		} catch (Exception e) {
			rm.setState("500");
			rm.setMsgInfo("新增库存数据失败！");
			return rm;
		}
		rm.setState("200");
		return rm; 
	}
	
}

