| | |
| | | { |
| | | // |
| | | oCn.BeginTran(); |
| | | |
| | | omodel.HSourceBillNo_Main = omodel.HMainSourceBillNo; |
| | | omodel.HSourceBillType_Main = omodel.HMainSourceBillType; |
| | | omodel.HSourceEntryID_Main = omodel.HMainSourceEntryID; |
| | | omodel.HSourceInterID_Main = omodel.HMainSourceInterID; |
| | | // 保存前处理 |
| | | if (!BeforeSave(omodel.HInterID, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 1, omodel.HSourceID, ref sReturn)) |
| | | { |
| | | return false; |
| | | } |
| | | //更新主表 |
| | | string sql = generateSQLReflection(omodel, "update", "HInterID"); |
| | | string sql = $@"update Sc_MESStopRestoreWorkBillMain set |
| | | HPrintQty = {omodel.HPrintQty},HICMOInterID = {omodel.HICMOInterID},HICMOEntryID = {omodel.HICMOEntryID}, |
| | | HICMOBillNo = '{omodel.HICMOBillNo}',HProcExchInterID = {omodel.HProcExchInterID}, |
| | | HProcExchEntryID = {omodel.HProcExchEntryID},HProcExchBillNo = '{omodel.HProcExchBillNo}', |
| | | HSourceInterID_Main = {omodel.HSourceInterID_Main},HSourceEntryID_Main = {omodel.HSourceEntryID_Main}, |
| | | HSourceBillNo_Main = '{omodel.HSourceBillNo_Main}',HSourceBillType_Main = '{omodel.HSourceBillType_Main}', |
| | | HMaterID = {omodel.HMaterID},HProcID = {omodel.HProcID},HBeginWorkTime = '{omodel.HBeginWorkTime}', |
| | | HSourceID = {omodel.HSourceID},HGroupID = {omodel.HGroupID},HDeptID = {omodel.HGroupID}, |
| | | HEmpID = {omodel.HEmpID},HStopReason = '{omodel.HStopReason}',HReportType = '{omodel.HReportType}', |
| | | HBarCodeMakeDate = '{omodel.HBarCodeMakeDate}',HYear = '{omodel.HYear}',HPeriod = {omodel.HPeriod}, |
| | | HBillType = '{omodel.HBillType}',HBillSubType = '{omodel.HBillSubType}',HDate = '{omodel.HDate}', |
| | | HCheckItemNowID = {omodel.HCheckItemNowID} ,HCheckItemNextID = {omodel.HCheckItemNextID}, |
| | | HCheckFlowID = {omodel.HCheckFlowID},HRemark = '{omodel.HRemark}',HUpDater = '{omodel.HUpDater}',HUpDateDate = getdate(), |
| | | HMainSourceBillNo = '{omodel.HMainSourceBillNo}',HMainSourceBillType = '{omodel.HMainSourceBillNo}', |
| | | HMainSourceInterID = {omodel.HMainSourceInterID},HMainSourceEntryID = {omodel.HMainSourceEntryID} |
| | | where HInterID = ${omodel.HInterID}"; |
| | | oCn.RunProcReturn(sql, MvarItemKey); |
| | | //删除关联 |
| | | DeleteRelation(ref sReturn, lngBillKey); |
| | |
| | | // "," + oSub.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() + |
| | | // ") "); |
| | | } |
| | | //foreach (Model.ClsSc_MESStopRestoreWorkBillSub_Item oSub2 in DetailColl1) |
| | | //{ |
| | | // oCn.RunProc("Insert into Sc_MESStopWorkBillSub_Item " + |
| | | // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + |
| | | // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + |
| | | // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | // ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" + |
| | | |
| | | // ") values(" |
| | | // + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" + |
| | | // ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() + |
| | | // "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() + |
| | | // "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() + |
| | | // ") "); |
| | | //} |
| | | // |
| | | //foreach (Model.ClsSc_MESStopRestoreWorkBillSub oSub in DetailColl) |
| | | //{ |
| | | // Ds = oCn.RunProcReturn("exec h_p_Sc_MESStopWorkBill_Qty " + oSub.HICMOInterID, ""); |
| | | // if (Ds.Tables[0].Rows.Count == 0) |
| | | // return; |
| | | // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") |
| | | // { |
| | | // sReturn = "汇报数量超过计划数量!不允许保存"; |
| | | // return false; |
| | | // } |
| | | //} |
| | | //保存后控制 |
| | | if (!AfterSave(omodel.HInterID, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 2, ref sReturn)) |
| | | { |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | sReturn = "修改单据成功!"; |
| | | oCn.Commit(); |
| | | return true; |
| | |
| | | // "," + oSub.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() + |
| | | // ") "); |
| | | } |
| | | //foreach (Model.ClsSc_MESStopRestoreWorkBillSub_Item oSub2 in DetailColl1) |
| | | //{ |
| | | // oCn.RunProc("Insert into Sc_MESStopWorkBillSub_Item " + |
| | | // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + |
| | | // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + |
| | | // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | // ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" + |
| | | |
| | | // ") values(" |
| | | // + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" + |
| | | // ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() + |
| | | // "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() + |
| | | // "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() + |
| | | // ") "); |
| | | //} |
| | | // |
| | | //foreach (Model.ClsSc_MESStopRestoreWorkBillSub oSub in DetailColl) |
| | | //{ |
| | | // Ds = oCn.RunProcReturn("exec h_p_Sc_MESStopWorkBill_Qty " + oSub.HICMOInterID, ""); |
| | | // if (Ds.Tables[0].Rows.Count == 0) |
| | | // return; |
| | | // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") |
| | | // { |
| | | // sReturn = "汇报数量超过计划数量!不允许保存"; |
| | | // return false; |
| | | // } |
| | | //} |
| | | // |
| | | //保存后控制 |
| | | if (!AfterSave(omodel.HInterID, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 1, ref sReturn)) |
| | | { |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | // 保存后处理 |
| | | sReturn = omodel.HInterID.ToString(); ; |