Browse Source

Merge branch 'master' of ssh://10.10.101.21/source/mes-client

Hcsy 8 years ago
parent
commit
d06f8730e6

+ 20 - 8
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -78,14 +78,19 @@ namespace UAS_MES.Make
             //加载表单数据
             //加载表单数据
             string Err = "";
             string Err = "";
             sql.Clear();
             sql.Clear();
-            sql.Append("select pr_code,pa_outboxcode,pa_makecode,pa_sccode,nvl(pa_downstatus,0) pa_downstatus,pa_checkno,pa_status,pr_packrule,pr_detail,pa_packageqty,pa_standardqty,pr_outboxinnerqty,pa_currentqty from package left join product on pa_prodcode=");
+            sql.Append("select pr_code,pa_outboxcode,pa_prodcode,pa_makecode,pa_sccode,nvl(pa_downstatus,0) pa_downstatus,pa_checkno,pa_status,pr_packrule,pr_detail,pa_packageqty,nvl(pa_standardqty,0) pa_standardqty,pr_outboxinnerqty,pa_currentqty from package left join product on pa_prodcode=");
             sql.Append("pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
             sql.Append("pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
             Err = "箱号";
             Err = "箱号";
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             if (dt.Rows.Count > 0)
             if (dt.Rows.Count > 0)
             {
             {
+                //记录该数据保证在修改不被允许的前提下能偶回复之前的值
                 StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
                 StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
                 BaseUtil.SetFormValue(this.Controls, dt);
                 BaseUtil.SetFormValue(this.Controls, dt);
+                if (pa_standardqty.Text != "0")
+                {
+                    pr_outboxinnerqty.Text = pa_standardqty.Text;
+                }
             }
             }
             else OperateResult.AppendText(">>" + Err + "不存在\n", Color.Red);
             else OperateResult.AppendText(">>" + Err + "不存在\n", Color.Red);
         }
         }
@@ -135,8 +140,9 @@ namespace UAS_MES.Make
                 {
                 {
                     if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
                     if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
                     {
                     {
+                        //获取序列号信息
                         sql.Clear();
                         sql.Clear();
-                        sql.Append("select ms_makecode,pr_code,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,pr_code,pr_detail,nvl(pa_standardqty,pr_outboxinnerqty) ");
+                        sql.Append("select pr_code,ms_makecode,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,pr_code,pr_detail,");
                         sql.Append("pr_outboxinnerqty from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
                         sql.Append("pr_outboxinnerqty from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
                         sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
                         sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
                         dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                         dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
@@ -145,13 +151,15 @@ namespace UAS_MES.Make
                             StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
                             StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
                             BaseUtil.SetFormValue(this.Controls, dt);
                             BaseUtil.SetFormValue(this.Controls, dt);
                         }
                         }
-                        if (pa_standardqty.Text != "0")
+                        //保证箱内容量不会被重置
+                        if (pa_standardqty.Text != "0" && pa_standardqty.Text != "")
                         {
                         {
-                            pr_outboxinnerqty.Text = pa_standardqty.Text;
+                            pr_outboxinnerqty.Value = int.Parse(pa_standardqty.Text);
                         }
                         }
                         if (pa_outboxcode.Text == "")
                         if (pa_outboxcode.Text == "")
                         {
                         {
                             string boxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString();
                             string boxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString();
+                            //序列号存在箱号的情况下获取所有的装箱数据
                             if (boxcode != "")
                             if (boxcode != "")
                             {
                             {
                                 pa_outboxcode.Text = boxcode;
                                 pa_outboxcode.Text = boxcode;
@@ -159,6 +167,7 @@ namespace UAS_MES.Make
                             }
                             }
                             else
                             else
                             {
                             {
+                                //如果勾选了自动生成箱号,在封箱或者首次
                                 if (AutoGenBoxCode.Checked && (pa_status.Text == "1" || pa_status.Text == ""))
                                 if (AutoGenBoxCode.Checked && (pa_status.Text == "1" || pa_status.Text == ""))
                                     pa_outboxcode.GeneratePaCode_Click(new object(), new EventArgs());
                                     pa_outboxcode.GeneratePaCode_Click(new object(), new EventArgs());
                             }
                             }
@@ -184,12 +193,12 @@ namespace UAS_MES.Make
                                     if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
                                     if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
                                     {
                                     {
                                         sql.Clear();
                                         sql.Clear();
-                                        sql.Append("select 1 from package left join make on pa_salecode=ma_salecode left join makeserial ");
+                                        sql.Append("select 1 from package left join make on pa_salecode=ma_salecode and pa_prodcode=ma_prodcode left join makeserial ");
                                         sql.Append("on ma_code=ms_makecode where pa_outboxcode='" + pa_outboxcode.Text + "' and ms_id='" + oMsID + "'");
                                         sql.Append("on ma_code=ms_makecode where pa_outboxcode='" + pa_outboxcode.Text + "' and ms_id='" + oMsID + "'");
                                         DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                                         DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                                         if (dt.Rows.Count == 0)
                                         if (dt.Rows.Count == 0)
                                         {
                                         {
-                                            OperateResult.AppendText(">>序列号" + sn_code.Text + "所属订单号和当前箱号订单不相等\n", Color.Red, sn_code);
+                                            OperateResult.AppendText(">>序列号" + sn_code.Text + "所属订单号和当前箱号订单不相等或者订单产品不相等\n", Color.Red, sn_code);
                                             return;
                                             return;
                                         }
                                         }
                                     }
                                     }
@@ -241,13 +250,15 @@ namespace UAS_MES.Make
                                         OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
                                         OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
                                         LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "采集成功", sn_code.Text, "");
                                         LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "采集成功", sn_code.Text, "");
                                         //满箱更新状态为1
                                         //满箱更新状态为1
-                                        if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) + 1 == pr_outboxinnerqty.Value)
+                                        LoadData();
+                                        if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) == pr_outboxinnerqty.Value)
                                         {
                                         {
                                             dh.UpdateByCondition("package", "pa_status=1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                                             dh.UpdateByCondition("package", "pa_status=1", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                                            pa_status.Text = "1";
+                                            pa_standardqty.Text = "";
                                             if (AutoPrint.Checked)
                                             if (AutoPrint.Checked)
                                                 Print_Click(new object(), new EventArgs());
                                                 Print_Click(new object(), new EventArgs());
                                         }
                                         }
-                                        LoadData();
                                         LoadGridData();
                                         LoadGridData();
                                         sn_code.Clear();
                                         sn_code.Clear();
                                     }
                                     }
@@ -311,6 +322,7 @@ namespace UAS_MES.Make
             {
             {
                 dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                 dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                 pa_status.Text = "1";
                 pa_status.Text = "1";
+                pa_standardqty.Text = "";
                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "封箱成功", pa_outboxcode.Text, "");
                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "装箱采集", "封箱成功", pa_outboxcode.Text, "");
                 OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "封箱成功\n", Color.Green);
                 OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "封箱成功\n", Color.Green);
             }
             }

+ 14 - 8
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -144,8 +144,8 @@ namespace UAS_MES.Make
             //加载表单数据
             //加载表单数据
             string Err = "";
             string Err = "";
             sql.Clear();
             sql.Clear();
-            sql.Append("select pr_cartonmaxw,pa_makecode,pr_cartonunit,pr_cartonminw,pr_cartongw,pa_outboxcode,pa_sccode,nvl(pa_downstatus,0) pa_downstatus,pa_checkno,");
-            sql.Append("pa_status,pr_packrule,pr_detail,pa_packageqty,nvl(pa_standardqty,pr_outboxinnerqty)pr_outboxinnerqty,pa_currentqty from package left join ");
+            sql.Append("select pa_prodcode,pr_cartonmaxw,pa_makecode,pr_cartonunit,pr_cartonminw,pr_cartongw,pa_outboxcode,pa_sccode,nvl(pa_downstatus,0) pa_downstatus,pa_checkno,");
+            sql.Append("pa_status,pr_packrule,pr_detail,pa_packageqty,nvl(pa_standardqty,0)pa_standardqty,pa_currentqty from package left join ");
             sql.Append("product on pa_prodcode=pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
             sql.Append("product on pa_prodcode=pr_code where pa_outboxcode='" + pa_outboxcode.Text + "'");
             Err = "箱号";
             Err = "箱号";
             DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
@@ -161,6 +161,9 @@ namespace UAS_MES.Make
                 MinWeight = double.Parse(_minweight == "" ? "0" : _minweight);
                 MinWeight = double.Parse(_minweight == "" ? "0" : _minweight);
                 StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
                 StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
                 BaseUtil.SetFormValue(this.Controls, dt);
                 BaseUtil.SetFormValue(this.Controls, dt);
+                //保证按照箱内容量展示
+                if (pa_standardqty.Text != "0")
+                    pr_outboxinnerqty.Text = pa_standardqty.Text;
                 if (Weight - MinWeight == MaxWeight - Weight)
                 if (Weight - MinWeight == MaxWeight - Weight)
                     pr_cartonboxgw.Text = Weight + "±" + (MaxWeight - Weight);
                     pr_cartonboxgw.Text = Weight + "±" + (MaxWeight - Weight);
                 else
                 else
@@ -214,7 +217,7 @@ namespace UAS_MES.Make
                     if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
                     if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
                     {
                     {
                         sql.Clear();
                         sql.Clear();
-                        sql.Append("select ms_makecode,pr_code,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,pr_code,pr_detail,nvl(pa_standardqty,pr_outboxinnerqty) ");
+                        sql.Append("select ms_makecode,pr_code,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,pr_code,pr_detail,");
                         sql.Append("pr_outboxinnerqty from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
                         sql.Append("pr_outboxinnerqty from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
                         sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
                         sql.Append("on pd_barcode=ms_sncode left join package on pa_id =pd_paid where ms_id='" + oMsID + "'");
                         dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                         dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
@@ -223,9 +226,9 @@ namespace UAS_MES.Make
                             StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
                             StandardQTY = decimal.Parse(dt.Rows[0]["pr_outboxinnerqty"].ToString());
                             BaseUtil.SetFormValue(this.Controls, dt);
                             BaseUtil.SetFormValue(this.Controls, dt);
                         }
                         }
-                        if (pa_standardqty.Text != "0")
+                        if (pa_standardqty.Text != "0" && pa_standardqty.Text != "")
                         {
                         {
-                            pr_outboxinnerqty.Text = pa_standardqty.Text;
+                            pr_outboxinnerqty.Value = int.Parse(pa_standardqty.Text);
                         }
                         }
                         if (pa_outboxcode.Text == "")
                         if (pa_outboxcode.Text == "")
                         {
                         {
@@ -262,7 +265,7 @@ namespace UAS_MES.Make
                                     if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
                                     if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
                                     {
                                     {
                                         sql.Clear();
                                         sql.Clear();
-                                        sql.Append("select 1 from package left join make on pa_salecode=ma_salecode left join makeserial ");
+                                        sql.Append("select 1 from package left join make on pa_salecode=ma_salecode and pa_prodcode=ma_prodcode left join makeserial ");
                                         sql.Append("on ma_code=ms_makecode where pa_outboxcode='" + pa_outboxcode.Text + "' and ms_id='" + oMsID + "'");
                                         sql.Append("on ma_code=ms_makecode where pa_outboxcode='" + pa_outboxcode.Text + "' and ms_id='" + oMsID + "'");
                                         DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                                         DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                                         if (dt.Rows.Count == 0)
                                         if (dt.Rows.Count == 0)
@@ -318,18 +321,21 @@ namespace UAS_MES.Make
                                         LoadCheckQTY();
                                         LoadCheckQTY();
                                         OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
                                         OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
                                         //满箱更新状态为1
                                         //满箱更新状态为1
-                                        if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) + 1 == int.Parse(pr_outboxinnerqty.Text))
+                                        LoadData();
+                                        if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) == int.Parse(pr_outboxinnerqty.Text))
                                         {
                                         {
                                             //检查重量合格
                                             //检查重量合格
                                             if (float.Parse(weight.Text) > MinWeight && float.Parse(weight.Text) < MaxWeight)
                                             if (float.Parse(weight.Text) > MinWeight && float.Parse(weight.Text) < MaxWeight)
                                             {
                                             {
                                                 dh.UpdateByCondition("package", "pa_status=1,pa_weight='" + weight.Text + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                                                 dh.UpdateByCondition("package", "pa_status=1,pa_weight='" + weight.Text + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                                                pa_standardqty.Text = "";
+                                                pa_status.Text = "1";
                                                 if (AutoPrint.Checked)
                                                 if (AutoPrint.Checked)
                                                     Print_Click(new object(), new EventArgs());
                                                     Print_Click(new object(), new EventArgs());
                                             }
                                             }
                                             else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量\n", Color.Red);
                                             else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量\n", Color.Red);
                                         }
                                         }
-                                        LoadData();
+
                                         LoadGridData();
                                         LoadGridData();
                                         sn_code.Clear();
                                         sn_code.Clear();
                                     }
                                     }

+ 18 - 0
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.resx

@@ -212,6 +212,24 @@
   <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
     <value>True</value>
   </metadata>
   </metadata>
+  <metadata name="pd_barcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pa_outboxcode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pa_prodcode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pd_innerqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pa_indate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <data name="SendCheck.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
   <data name="SendCheck.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m