| | |
| | | ",HGroupID=" + omodel.HGroupID.ToString() + |
| | | ",HCheckType='" + omodel.HCheckType + "'" + |
| | | " where HInterID=" + lngBillKey.ToString()); |
| | | |
| | | //获取明细行修改前数量 |
| | | Int64 HBackQty = 0; |
| | | Ds = oCn.RunProcReturn("select isnull(sum(isnull(HQty,0)),0) + isnull(sum(isnull(HWasterQty,0)),0) as HBackQty from Sc_ICMOReportBillSub where HInterID = " + lngBillKey, "Sc_ICMOReportBillSub"); |
| | | if (Ds != null && Ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | HBackQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBackQty"]); |
| | | } |
| | | |
| | | //删除关联 |
| | | DeleteRelation(lngBillKey); |
| | | //删除子表 |
| | |
| | | "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + |
| | | "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "','" + oSub.HBarCode + "'," + oSub.HICMOEntryID + |
| | | ") "); |
| | | |
| | | //反写产量汇报单,质量汇报单关联字段,生产订单关联数量 |
| | | Ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_ReverseWriteQty " + omodel.HInterID + "," + oSub.HEntryID + ",'" + omodel.HBillNo + "'," + |
| | | DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + "," + DetailColl[0].HICMOBillNo + ",'" + DetailColl[0].HSourceID + "','" + |
| | | "Edit" + "'," + HBackQty |
| | | , "h_p_Sc_ICMOReportBill_ReverseWriteQty"); |
| | | if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBack"]) == "1") |
| | | { |
| | | sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | if (omodel.HCheckType == "合格") |
| | | { |
| | |
| | | "from Sc_ICMOReportBillSub a inner join Gy_BarCodeBill b on a.HBarCode=b.HBarCode " + |
| | | "Where a.HInterID=" + lngBillKey.ToString() + " "); |
| | | } |
| | | //保存后控制========================================= |
| | | Ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_AfterSaveCtrl_New " + omodel.HInterID + "," + DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + ",'" + DetailColl[0].HICMOBillNo + "'", "h_p_Sc_ICMOReportBill_AfterSaveCtrl_New"); |
| | | |
| | | if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBack"]) == "1") |
| | | { |
| | | sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | //========================================================= |
| | | //审核单据 |
| | | Ds = oCn.RunProcReturn("EXEC h_p_Sc_ICMOReportBill_Check " + omodel.HInterID.ToString() + ",'" + omodel.HMaker+ "'", "h_p_Sc_ICMOReportBill_Check"); |
| | | if (Ds == null) |
| | |
| | | oSub.HREQENTRYSEQ + "," + oSub.HREQENTRYID + "," + oSub.HMOMAINENTRYID + "," + oSub.HSTOCKINQUASELQTY + "," + oSub.HPRODUCTTYPE + ",'" + oSub.HPROJECTNO + "'," + oSub.HICMOENTRYSEQ + "," + oSub.HSEQ + ",'" + oSub.HPRODUCEDATE + "','" + oSub.HEXPIRYDATE + "'," + oSub.HBASEUNITID + "," + oSub.HDEPTID + "," + oSub.HGroupID + ",'" + oSub.HDESCRIPTION + "','" + oSub.HSourceNumber + "'," + oSub.HQPQty + "," + oSub.HICMOEntryID + "," + oSub.HWhID + "," + oSub.HSPID + ",'" + oSub.HBatChNo + "'," + oSub.HAuxPropID + ",'" + oSub.HMTONo + "'," + oSub.HPlanMode + "," + oSub.HERPInterID + "," + oSub.HERPEntryID + |
| | | ") "); |
| | | |
| | | //反写产量汇报单临时表关联字段信息 |
| | | string sql = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp set " + |
| | | " HICMOReportBillNo ='" + omodel.HBillNo + |
| | | "', HRelationInterID='" + omodel.HInterID + |
| | | "', HRelationEntryID='" + oSub.HEntryID + |
| | | "' from Sc_ICMOBillWorkQtyStatus_Tmp a where a.HICMOBillNo='" + DetailColl[0].HICMOBillNo + "' and a.HSourceID='" + DetailColl[0].HSourceID + "' and HICMOInterID='" + DetailColl[0].HICMOInterID + "' and a.HICMOEntryID='" + DetailColl[0].HICMOEntryID + "' and HRelationInterID='0'"); |
| | | oCn.RunProc(sql); |
| | | ////反写产量汇报单临时表关联字段信息 |
| | | //string sql = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp set " + |
| | | // " HICMOReportBillNo ='" + omodel.HBillNo + |
| | | // "', HRelationInterID='" + omodel.HInterID + |
| | | // "', HRelationEntryID='" + oSub.HEntryID + |
| | | // "' from Sc_ICMOBillWorkQtyStatus_Tmp a where a.HICMOBillNo='" + DetailColl[0].HICMOBillNo + "' and a.HSourceID='" + DetailColl[0].HSourceID + "' and HICMOInterID='" + DetailColl[0].HICMOInterID + "' and a.HICMOEntryID='" + DetailColl[0].HICMOEntryID + "' and HRelationInterID='0'"); |
| | | //oCn.RunProc(sql); |
| | | |
| | | //反写质量汇报单临时表关联字段信息 |
| | | string sql2 = string.Format(@"update Sc_ICMOBillQualityStatus_Tmp set " + |
| | | " HRelationBillNo ='" + omodel.HBillNo + |
| | | "', HRelationInterID='" + omodel.HInterID + |
| | | "' from Sc_ICMOBillQualityStatus_Tmp a where a.HICMOBillNo='" + DetailColl[0].HICMOBillNo + "' and a.HSourceID='" + DetailColl[0].HSourceID + "' and HICMOInterID='" + DetailColl[0].HICMOInterID + "' and a.HICMOEntryID='" + DetailColl[0].HICMOEntryID + "' and HRelationInterID='0'"); |
| | | oCn.RunProc(sql2); |
| | | ////反写质量汇报单临时表关联字段信息 |
| | | //string sql2 = string.Format(@"update Sc_ICMOBillQualityStatus_Tmp set " + |
| | | // " HRelationBillNo ='" + omodel.HBillNo + |
| | | // "', HRelationInterID='" + omodel.HInterID + |
| | | // "' from Sc_ICMOBillQualityStatus_Tmp a where a.HICMOBillNo='" + DetailColl[0].HICMOBillNo + "' and a.HSourceID='" + DetailColl[0].HSourceID + "' and HICMOInterID='" + DetailColl[0].HICMOInterID + "' and a.HICMOEntryID='" + DetailColl[0].HICMOEntryID + "' and HRelationInterID='0'"); |
| | | //oCn.RunProc(sql2); |
| | | |
| | | //反写产量汇报单,质量汇报单关联字段,生产订单关联数量 |
| | | ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_ReverseWriteQty " + omodel.HInterID + "," + oSub.HEntryID + ",'" + omodel.HBillNo + "'," + |
| | | DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + "," + DetailColl[0].HICMOBillNo + ",'" + DetailColl[0].HSourceID + "','" + |
| | | "Add" + "'," + 0 |
| | | , "h_p_Sc_ICMOReportBill_ReverseWriteQty"); |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1") |
| | | { |
| | | sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | // |
| | | //foreach (Model.ClsSc_ICMOReportBillSub oSub in DetailColl) |
| | |
| | | // |
| | | // |
| | | //保存后控制========================================= |
| | | ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_AfterSaveCtrl_New " + omodel.HInterID + "," + oSub.HICMOInterID + "," + oSub.HICMOEntryID + ",'" + oSub.HICMOBillNo + "'", "h_p_Sc_ICMOReportBill_AfterSaveCtrl_New"); |
| | | ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_AfterSaveCtrl_New " + omodel.HInterID + "," + DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + ",'" + DetailColl[0].HICMOBillNo + "'", "h_p_Sc_ICMOReportBill_AfterSaveCtrl_New"); |
| | | |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1") |
| | | { |
| | |
| | | string HICMOInterID = ds.Tables[0].Rows[0]["HICMOInterID"].ToString(); |
| | | string HICMOEntryID = ds.Tables[0].Rows[0]["HICMOEntryID"].ToString(); |
| | | // |
| | | //更新产量汇报临时表是否报检申请状态 |
| | | string sql1 = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp set HRelationInterID='0',HRelationEntryID='0',HICMOReportBillNo=null where HICMOReportBillNo='" + HBillNo + "' and HICMOInterID='"+ HICMOInterID + "' and HICMOEntryID='"+ HICMOEntryID + "'"); |
| | | oCn.RunProc(sql1); |
| | | //更新质量汇报临时表是否报检申请状态 |
| | | string sql2 = string.Format(@"update Sc_ICMOBillQualityStatus_Tmp set HRelationInterID='0',HRelationBillNo='' where HRelationBillNo='" + HBillNo + "' and HRelationInterID='" + lngBillKey + "'"); |
| | | oCn.RunProc(sql2); |
| | | |
| | | ////更新产量汇报临时表是否报检申请状态 |
| | | //string sql1 = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp set HRelationInterID='0',HRelationEntryID='0',HICMOReportBillNo=null where HICMOReportBillNo='" + HBillNo + "' and HICMOInterID='"+ HICMOInterID + "' and HICMOEntryID='"+ HICMOEntryID + "'"); |
| | | //oCn.RunProc(sql1); |
| | | ////更新质量汇报临时表是否报检申请状态 |
| | | //string sql2 = string.Format(@"update Sc_ICMOBillQualityStatus_Tmp set HRelationInterID='0',HRelationBillNo='' where HRelationBillNo='" + HBillNo + "' and HRelationInterID='" + lngBillKey + "'"); |
| | | //oCn.RunProc(sql2); |
| | | //更新产量/质量汇报临时表是否报检申请状态,撤回生产订单关联数量 |
| | | ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_BeforeDel " + lngBillKey + ",'" + HBillNo + "'," + HICMOInterID + "," + HICMOEntryID , "h_p_Sc_ICMOReportBill_BeforeDel"); |
| | | |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1") |
| | | { |
| | | sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | //删除关联 |
| | | DeleteRelation(ref sReturn, lngBillKey); |
| | | //删除明细表 |