zrg
2024-10-09 243e86af1a7c74c8bfda3bb41f29a11fef13c065
WebAPI/DLL/ClsSc_MESBeginWorkBill.cs
@@ -330,13 +330,6 @@
                    return false;
                }
                //保存后控制
                if (!AfterSave(omodel.HInterID, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 1, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                //获取最近的上模单  把工单跟模具进行绑定
                ds = oCn.RunProcReturn(@"select  HICMOInterID,HICMOEntryID,HSourceInterID,HSourceEntryID,HSourceID from Sc_ICMOBillStatus_Tmp where HInterID=" + omodel.HMainSourceInterID.ToString(), "Sc_ICMOBillStatus_Tmp");
@@ -349,14 +342,29 @@
                    string HSourceID = ds.Tables[0].Rows[0]["HSourceID"].ToString();
                    ds = oCn.RunProcReturn(@"select  HMouldID from Sc_MouldUpperBillMain a
inner join Sc_MouldUpperBillSub b on a.HInterID = b.HInterID where HICMOInterID=" + HICMOInterID + " and HICMOEntryID=" + HICMOEntryID + " and HProcExchInterID=" + HSourceInterID + " and  HProcExchEntryID=" + HSourceEntryID + " and HSourceID=" + HSourceID + " order by HMakeDate desc", "Sc_MouldUpperBillMain");
                        inner join Sc_MouldUpperBillSub b on a.HInterID = b.HInterID where HICMOInterID=" + HICMOInterID + " and HICMOEntryID=" + HICMOEntryID + " and HProcExchInterID=" + HSourceInterID + " and  HProcExchEntryID=" + HSourceEntryID + " and HSourceID=" + HSourceID + " order by HMakeDate desc", "Sc_MouldUpperBillMain");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        oCn.RunProc("update Sc_ICMOBillStatus_Tmp set HMouldID= " + ds.Tables[0].Rows[0]["HMouldID"].ToString() + " where HInterID=" + omodel.HMainSourceInterID.ToString());
                    }
                    else
                    {
                        ds = oCn.RunProcReturn(@"select  HMouldID from Sc_MouldUpperBillMain a
                        inner join Sc_MouldUpperBillSub b on a.HInterID = b.HInterID where  HSourceID=" + HSourceID + " order by HMakeDate desc", "Sc_MouldUpperBillMain");
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            oCn.RunProc("update Sc_ICMOBillStatus_Tmp set HMouldID= " + ds.Tables[0].Rows[0]["HMouldID"].ToString() + " where HInterID=" + omodel.HMainSourceInterID.ToString());
                        }
                    }
                }
                //保存后控制
                if (!AfterSave(omodel.HInterID, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 1, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                sReturn = omodel.HInterID.ToString();
                oCn.Commit();
                return true;