Эх сурвалжийг харах

产品BOM之外的批管控物料换料逻辑补充

Hcsy 8 жил өмнө
parent
commit
2c981368bf

+ 23 - 2
UAS-MES/FunctionCode/Make/Make_Decompose.cs

@@ -269,8 +269,29 @@ namespace UAS_MES.Make
                             }
                             else
                             {
-                                OperateResult.AppendText(">>序列号" + ms_sncode.Text + "途程未维护工序BOM\n", Color.Red);
-                                return;
+                                //当前备料信息不再工序BOM中,为BOM之外的批管控物料备料
+                                if (!dh.CheckExist("makesourcestock", " (MSS_FPRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "' or MSS_PRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "') and mss_barcode = '" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "'"))
+                                {
+                                    OperateResult.AppendText(">>物料" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "岗位备料无条码" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "\n", Color.Red);
+                                    continue;
+                                }
+                                else
+                                {
+                                    sql.Clear();
+                                    sql.Append("select mss_id,MSS_REMAIN,MSS_BASEQTY from makesourcestock where  (MSS_FPRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "' or MSS_PRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "') and mss_barcode = '" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "'");
+                                    dtst = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                                    int MSS_REMAIN = int.Parse(dtst.Rows[0]["MSS_REMAIN"].ToString());
+                                    int MSS_BASEQTY = int.Parse(dtst.Rows[0]["MSS_BASEQTY"].ToString());
+                                    if (MSS_REMAIN < MSS_BASEQTY)
+                                    {
+                                        OperateResult.AppendText(">>物料" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "条码" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "备料不足\n", Color.Red);
+                                        continue;
+                                    }
+                                    else
+                                    {
+                                        dh.UpdateByCondition("makesourcestock", "MSS_REMAIN = NVL(MSS_REMAIN, 0) - MSS_BASEQTY,MSS_USEQTY = NVL(MSS_USEQTY, 0) + MSS_BASEQTY,mss_madeqty=NVL(mss_madeqty,0)+ceil(MSS_USEQTY/MSS_BASEQTY)", " mss_id = '" + dtst.Rows[0]["mss_id"].ToString() + "' and (MSS_FPRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "' or MSS_PRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "') and mss_barcode = '" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "'");
+                                    }
+                                }
                             }
                             //判断生产信息
                             sql.Clear();