| | |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | |
| | | //获取对应条码解析数据 |
| | | string sHMaterNumber = ""; //物料编码 |
| | | string sHMaterName = ""; //物料名称 |
| | | string sHSupNumber = ""; //供应商编码 |
| | | string sHBatchNo = ""; //来料批号 |
| | | string sHBarQty = ""; //来料数量 |
| | | string sHPOOrderBillNo = ""; //采购订单编码 |
| | | string[] str = sBarCode.Split('@'); |
| | | |
| | | if (str.Length != 4 && str.Length < 6) |
| | | //条码规则:物料编码 @供应商编码 @生产日批号8位日期码 @采购订单编码 @来料总数量 |
| | | if (str.Length == 5) |
| | | { |
| | | sErrMsg = "1、条码档案中不存在该条码,请确认条码是否正确!2、条码解析失败,条码格式错误,必须包含3个 @ 分隔符或不少于5个 @ 分隔符!"; |
| | | sHMaterNumber = str[0]; |
| | | sHSupNumber = str[1]; |
| | | sHBatchNo = str[2]; |
| | | sHPOOrderBillNo = str[3]; |
| | | sHBarQty = str[4]; |
| | | } |
| | | //条码规则:物料编码 @供应商编码 @来料批号 @来料数量 @采购订单编码 @流水号 |
| | | else if (str.Length == 6) |
| | | { |
| | | sHMaterNumber = str[0]; |
| | | sHSupNumber = str[1]; |
| | | sHBatchNo = str[2]; |
| | | sHBarQty = str[3]; |
| | | sHPOOrderBillNo = str[4]; |
| | | } |
| | | //条码规则:物料编码 @供应商编码 @物料名称 @批号 @来料数量 @采购订单编码 @流水号 |
| | | else if (str.Length == 7) |
| | | { |
| | | sHMaterNumber = str[0]; |
| | | sHSupNumber = str[1]; |
| | | sHMaterName = str[2]; |
| | | sHBatchNo = str[3]; |
| | | sHBarQty = str[4]; |
| | | sHPOOrderBillNo = str[5]; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "1、条码档案中不存在该条码,请确认条码是否正确!2、条码解析失败,条码格式错误,必须包含4-6个 @ 分隔符!"; |
| | | return false; |
| | | } |
| | | string sHMaterNumber = str[0]; //物料编码 |
| | | string sHSupNumber = str[1]; //供应商编码 |
| | | string sHBatchNo = str[2]; //来料批号/物料名称(包含3个@和5个@的为批号,包含6个@的为物料名称) |
| | | string sHBarQty = str[3]; //来料数量 |
| | | string sHPOOrderBillNo = str.Length > 4 ? str[4] : ""; //采购订单编码 |
| | | |
| | | //定义并赋值条码表所需写入字段数据 |
| | | Int64 HInterID = 0; //主ID |
| | |
| | | Int64 HMaterID = 0; //物料ID |
| | | Int64 HUnitID = 0; //计量单位ID |
| | | Int64 HAuxPropID = 0; //辅助属性ID |
| | | string HBatchNo = ""; //批次号 |
| | | string HBatchNo = sHBatchNo; //批次号 |
| | | string HMTONo = ""; //MTO号 |
| | | double HQty = DBUtility.ClsPub.isDoule(sHBarQty); //数量 |
| | | double HinitQty = 0; //初始化数量(生成条码时数量) |
| | |
| | | string HPinfan = ""; //品番 |
| | | DateTime HEndDate = DateTime.Now; ; //计划完工日期 |
| | | |
| | | //获取条码类型、源单类型 |
| | | if (str.Length == 4) |
| | | //数量判断 |
| | | if (HQty <= 0) |
| | | { |
| | | HBarCodeType = "批次条码"; |
| | | HSourceBillType = ""; |
| | | sErrMsg = "条码解析失败,条码数量不允许小于0!"; |
| | | return false; |
| | | } |
| | | |
| | | //获取物料相关数据 |
| | |
| | | else |
| | | { |
| | | HMaterID = DBUtility.ClsPub.isLong(Mds.Tables[0].Rows[0]["HItemID"]); |
| | | HMaterName = DBUtility.ClsPub.isStrNull(Mds.Tables[0].Rows[0]["HName"]); |
| | | if(sHMaterName!="") |
| | | { |
| | | HMaterName = sHMaterName; |
| | | } |
| | | else |
| | | { |
| | | HMaterName = DBUtility.ClsPub.isStrNull(Mds.Tables[0].Rows[0]["HName"]); |
| | | } |
| | | HUnitID = DBUtility.ClsPub.isLong(Mds.Tables[0].Rows[0]["HUnitID"]); |
| | | HISKFPERIOD = DBUtility.ClsPub.isBool(Mds.Tables[0].Rows[0]["HISKFPERIOD"]); |
| | | HEXPUNIT = DBUtility.ClsPub.isStrNull(Mds.Tables[0].Rows[0]["HEXPUNIT"]); |
| | | HEXPPERIOD = DBUtility.ClsPub.isDoule(Mds.Tables[0].Rows[0]["HEXPPERIOD"]); |
| | | } |
| | | |
| | | //获取批号 |
| | | if (str.Length == 6 || str.Length == 4) |
| | | { |
| | | HBatchNo = sHBatchNo; |
| | | } |
| | | |
| | | //获取供应商相关数据 |