Просмотр исходного кода

产成品交接添加物料编码限制

林勇 冯 3 лет назад
Родитель
Сommit
64aacf162f
1 измененных файлов с 39 добавлено и 4 удалено
  1. 39 4
      DK.Service/PMModuleLogic/PMModuleLogicPartial.cs

+ 39 - 4
DK.Service/PMModuleLogic/PMModuleLogicPartial.cs

@@ -4602,8 +4602,31 @@ and (TP_PM_ProductionDataIn.modeltype <> 5 or (exists (select 1 from tp_pm_grout
 					}
 					#endregion
 				}
-                #region 查询产品相关信息
-                /*
+
+				#region 校验包装箱编码于物料编码是否相同
+				string Strsql = @"SELECT MATERIALCODE FROM TP_PM_GROUTINGDAILYDETAIL WHERE MATERIALCODE = (SELECT MATERIALCODE FROM  TP_PM_GROUTINGDAILYDETAIL WHERE OUTLABELCODE = :barcode)";
+				OracleParameter[] paras2 = new OracleParameter[]{
+					new OracleParameter(":barcode",OracleDbType.NVarchar2,barcode,ParameterDirection.Input),
+                    //new OracleParameter(":Accountid",OracleDbType.Int32,sUserInfo.AccountID,ParameterDirection.Input),
+                };
+				DataSet dst = oracleConn.GetSqlResultToDs(Strsql, paras2);
+				if (dst == null && dst.Tables[0].Rows.Count == 0)
+				{
+					resultEntity.Result = -1;
+					resultEntity.Message = "物料编码与外包装箱码不匹配,不允许装板";
+					return resultEntity;
+				}
+				string barcodeSub = barcode.Substring(0, 14);
+				if (dst.Tables[0].Rows[0]["MATERIALCODE"].ToString() != barcodeSub)
+				{
+					resultEntity.Result = -1;
+					resultEntity.Message = "物料编码与外包装箱码不匹配,不允许装板";
+					return resultEntity;
+				}
+				#endregion
+
+				#region 查询产品相关信息
+				/*
 				sql = @"select 
                             gd.BarCode,
                             l.logoid,
@@ -4629,7 +4652,7 @@ and (TP_PM_ProductionDataIn.modeltype <> 5 or (exists (select 1 from tp_pm_grout
                             inner join TP_MST_Goods Goods on gd.goodsid=Goods.goodsid";
 				//where gd.BarCode=:BarCode";
                 */
-                sql = "select gd.BarCode,\n" +
+				sql = "select gd.BarCode,\n" +
                 "       l.logoid,\n" +
                 "       l.logocode,\n" +
                 "       l.logoname,\n" +
@@ -4649,7 +4672,10 @@ and (TP_PM_ProductionDataIn.modeltype <> 5 or (exists (select 1 from tp_pm_grout
                 "           (select a.workcode\n" +
                 "              from tp_mst_account a\n" +
                 "             where a.accountid = gd.accountid) || l.tagcode || gd.onlycode) as FinishedBarCode,\n" +
-                "       o.ORDERNO\n" +
+                "       o.ORDERNO,\n" +
+				"       SUBSTR( gd.OUTLABELCODE, 0, 14 ) OUTLABELCODE,\n" +
+				"       gd.MATERIALCODE,\n" +
+				"       gd.OUTLABELCODE as OUTLABELCODES\n" +
                 "  from TP_PM_GroutingDailyDetail gd\n" +
                 " inner join tp_mst_logo l\n" +
                 "    on gd.logoid = l.logoid\n" +
@@ -4677,6 +4703,15 @@ and (TP_PM_ProductionDataIn.modeltype <> 5 or (exists (select 1 from tp_pm_grout
                 dsResult = oracleConn.GetSqlResultToDs(sql);
                 if (dsResult != null && dsResult.Tables[0].Rows.Count > 0)
 				{
+					for(int i = 0; i< dsResult.Tables[0].Rows.Count; i++)
+					{
+						if (dsResult.Tables[0].Rows[i]["OUTLABELCODE"].ToString()  != dsResult.Tables[0].Rows[i]["MATERIALCODE"].ToString())
+						{
+							resultEntity.Result = -1;
+							resultEntity.Message = "物料编码与外包装箱码不匹配,不允许装板。外包装箱码:" + dsResult.Tables[0].Rows[i]["OUTLABELCODES"];
+							return resultEntity;
+						}
+					}
 					resultEntity.Result = 1;//成功
 											//resultEntity.Data = new DataSet();
 											//resultEntity.Data.Tables.Add(dsResult.Tables[0].Copy());