| | |
| | | { |
| | | // |
| | | DataSet Ds; |
| | | |
| | | //ä¿ååæ§å¶========================================= |
| | | string HBillNote = ""; |
| | | DataSet ds = oCn.RunProcReturn("Exec h_p_Sc_QualityReportBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Sc_QualityReportBill_BeforeSaveCtrl"); |
| | | if (ds == null) |
| | | { |
| | | sReturn = "ä¿ååå¤æå¤±è´¥ï¼"; |
| | | return false; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | sReturn = "ä¿å失败ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | return false; |
| | | } |
| | | //========================================================= |
| | | |
| | | oCn.BeginTran(); |
| | | //æ´æ°ä¸»è¡¨ |
| | | oCn.RunProc("UpDate Sc_QualityReportBillMain set " + |
| | | string mainSql = "UpDate Sc_QualityReportBillMain set " + |
| | | " HBillNo='" + omodel.HBillNo + "'" + //åºå®èµå¼=============== |
| | | ",HDate='" + omodel.HDate + "'" + |
| | | ",HYear='" + omodel.HYear.ToString() + "'" + |
| | |
| | | ",HRemark='" + omodel.HRemark + "'" + |
| | | ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + |
| | | ",HUpDateDate=getdate()" + |
| | | ",HSTOCKORGID=" + omodel.HSTOCKORGID + |
| | | //======================================== |
| | | ",HDeptID=" + omodel.HDeptID.ToString() + |
| | | ",HEmpID=" + omodel.HEmpID.ToString() + |
| | | ",HGroupID=" + omodel.HGroupID.ToString() + |
| | | " where HInterID=" + lngBillKey.ToString()); |
| | | " where HInterID=" + lngBillKey.ToString(); |
| | | |
| | | oCn.RunProc(mainSql); |
| | | //å é¤å
³è |
| | | //DeleteRelation(lngBillKey); |
| | | //å é¤å表 |
| | |
| | | omodel.HInterID = lngBillKey; |
| | | foreach (Model.ClsSc_QualityReportBillSub oSub in DetailColl) |
| | | { |
| | | oCn.RunProc("Insert into Sc_QualityReportBillSub " + |
| | | " (HInterID,HEntryID,HBillNo_bak,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + |
| | | string subSql = "Insert into Sc_QualityReportBillSub " + |
| | | " (HInterID,HEntryID,HBillNo_bak,HRemark" + |
| | | ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | ",HMaterID,HUnitID,HEmpID,HSourceID,HBarCode" + |
| | | ",HBadReasonID,HICMOInterID,HICMOEntryID,HICMOBillNo,HReportType" + |
| | | ",HAddr,HMaker,HMakeDate,HQty" + |
| | | ") values(" |
| | | + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HBillNo_bak + "','" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + |
| | | "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + |
| | | "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HEmpID.ToString() + "," + oSub.HSourceID.ToString() + ",'" + oSub.HBarCode + "'" + |
| | | "," + oSub.HBadReasonID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HReportType.ToString() + |
| | | ",'" + oSub.HAddr + "','" + oSub.HMaker + "','" + oSub.HMakeDate.ToShortDateString() + "'," + oSub.HQty.ToString() + |
| | | ") "); |
| | | ",HMaterID,HUnitID,HQty,HResult,HEmpID,HSourceID,HBadReasonID" + |
| | | ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcExchInterID,HProcExchEntryID,HProcExchBillNo" + |
| | | ",HBarCode,HReportType" + |
| | | ",HAddr,HMaker,HMakeDate" + |
| | | ") values(" + |
| | | "" + omodel.HInterID.ToString() + "" + |
| | | "," + oSub.HEntryID.ToString() + "" + |
| | | ",'" + omodel.HBillNo + "'" + |
| | | ",'" + oSub.HRemark + "'" + |
| | | "," + oSub.HSourceInterID.ToString() + "" + |
| | | "," + oSub.HSourceEntryID.ToString() + "" + |
| | | ",'" + oSub.HSourceBillNo + "'" + |
| | | ",'" + oSub.HSourceBillType + "'" + |
| | | "," + oSub.HRelationQty.ToString() + "" + |
| | | "," + oSub.HRelationMoney.ToString() + |
| | | |
| | | "," + oSub.HMaterID.ToString() + "" + |
| | | "," + oSub.HUnitID.ToString() + "" + |
| | | "," + oSub.HQty.ToString() + |
| | | ",'" + oSub.HResult + "'" + |
| | | "," + oSub.HEmpID.ToString() + "" + |
| | | "," + oSub.HSourceID.ToString() + "" + |
| | | "," + oSub.HBadReasonID.ToString() + "" + |
| | | |
| | | "," + oSub.HICMOInterID.ToString() + "" + |
| | | "," + oSub.HICMOEntryID.ToString() + "" + |
| | | ",'" + oSub.HICMOBillNo + "'" + |
| | | "," + oSub.HProcExchInterID + "" + |
| | | "," + oSub.HProcExchEntryID + "" + |
| | | ",'" + oSub.HProcExchBillNo + "'" + |
| | | ",'" + oSub.HBarCode + "'" + |
| | | |
| | | "," + oSub.HReportType.ToString() + |
| | | ",'" + oSub.HAddr + "'" + |
| | | ",'" + oSub.HMaker + "'" + |
| | | ",'" + oSub.HMakeDate.ToShortDateString() + "'" + |
| | | ") "; |
| | | oCn.RunProc(subSql); |
| | | } |
| | | |
| | | //=========================ä¿ååæ§å¶ |
| | | DataSet ds2 = oCn.RunProcReturn("h_p_Sc_QualityReportBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Sc_QualityReportBill_AfterSaveCtrl"); |
| | | if (ds2 == null) |
| | | { |
| | | sReturn = "ä¿ååæ§å¶å¤æå¤±è´¥ï¼"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | sReturn = "ä¿å失败2ï¼" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]); |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | //============================ |
| | | |
| | | sReturn = "ä¿®æ¹åæ®æåï¼"; |
| | | oCn.Commit(); |
| | | return true; |
| | |
| | | { |
| | | try |
| | | { |
| | | //å¾å°mainid |
| | | omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //è¥MAINDIéå¤åéæ°è·å |
| | | while (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew)) |
| | | { |
| | | omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | |
| | | //ä¿ååæ§å¶========================================= |
| | | string HBillNote = ""; |
| | | DataSet ds = oCn.RunProcReturn("Exec h_p_Sc_QualityReportBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Sc_QualityReportBill_BeforeSaveCtrl"); |
| | | if (ds == null) |
| | | { |
| | | sReturn = "ä¿ååå¤æå¤±è´¥ï¼"; |
| | | return false; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | sReturn = "ä¿å失败ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | return false; |
| | | } |
| | | //========================================================= |
| | | |
| | | oCn.BeginTran(); |
| | | |
| | | //主表 |
| | | oCn.RunProc("Insert Into Sc_QualityReportBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + |
| | | ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + |
| | | ",HEmpID,HGroupID,HDeptID" + |
| | | ") " + |
| | | " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" + |
| | | ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + |
| | | ", " + omodel.HEmpID.ToString() + "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + |
| | | ") "); |
| | | string mainSql = "insert into Sc_QualityReportBillMain(" + |
| | | "HBillType,HBillSubType,HInterID,HBillNo,HDate,HYear,HPeriod,HBillStatus,HRemark,HMaker,HMakeDate,HSTOCKORGID" + |
| | | ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" + |
| | | ",HEmpID,HGroupID,HDeptID" + |
| | | ") " + |
| | | " values(" + |
| | | "'" + this.BillType + "'" + |
| | | ",'" + this.HBillSubType + "'" + |
| | | "," + omodel.HInterID + "" + |
| | | ",'" + omodel.HBillNo + "'" + |
| | | ",'" + omodel.HDate + "'" + |
| | | "," + DateTime.Now.Year + "" + |
| | | "," + DateTime.Now.Month + "" + |
| | | "," + "1" + "" + |
| | | ",'" + omodel.HRemark + "'" + |
| | | ",'" + omodel.HMaker + "'" + |
| | | "," + "getdate()" + "" + |
| | | "," + omodel.HSTOCKORGID + "" + |
| | | "," + omodel.HMainSourceInterID + "" + |
| | | "," + omodel.HMainSourceEntryID + "" + |
| | | ",'" + omodel.HMainSourceBillNo + "'" + |
| | | ",'" + omodel.HMainSourceBillType + "'" + |
| | | "," + omodel.HEmpID + "" + |
| | | "," + omodel.HGroupID + "" + |
| | | "," + omodel.HDeptID + "" + |
| | | ")"; |
| | | |
| | | oCn.RunProc(mainSql); |
| | | |
| | | |
| | | //æå
¥å表 |
| | | foreach (Model.ClsSc_QualityReportBillSub oSub in DetailColl) |
| | | { |
| | | oCn.RunProc("Insert into Sc_QualityReportBillSub " + |
| | | " (HInterID,HEntryID,HBillNo_bak,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + |
| | | string subSql = "Insert into Sc_QualityReportBillSub " + |
| | | " (HInterID,HEntryID,HBillNo_bak,HRemark" + |
| | | ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | ",HMaterID,HUnitID,HEmpID,HSourceID,HBarCode" + |
| | | ",HBadReasonID,HICMOInterID,HICMOEntryID,HICMOBillNo,HReportType" + |
| | | ",HAddr,HMaker,HMakeDate,HQty" + |
| | | ") values(" |
| | | + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HBillNo_bak + "','" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + |
| | | "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + |
| | | "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HEmpID.ToString() + "," + oSub.HSourceID.ToString() + ",'" + oSub.HBarCode + "'" + |
| | | "," + oSub.HBadReasonID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HReportType.ToString() + |
| | | ",'" + oSub.HAddr + "','" + oSub.HMaker + "','" + oSub.HMakeDate.ToShortDateString() + "'," + oSub.HQty.ToString() + |
| | | ") "); |
| | | ",HMaterID,HUnitID,HQty,HResult,HEmpID,HSourceID,HBadReasonID" + |
| | | ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcExchInterID,HProcExchEntryID,HProcExchBillNo" + |
| | | ",HBarCode,HReportType" + |
| | | ",HAddr,HMaker,HMakeDate" + |
| | | ") values(" + |
| | | "" + omodel.HInterID.ToString() + "" + |
| | | "," + oSub.HEntryID.ToString() + "" + |
| | | ",'" + omodel.HBillNo + "'" + |
| | | ",'" + oSub.HRemark + "'" + |
| | | "," + oSub.HSourceInterID.ToString() + "" + |
| | | "," + oSub.HSourceEntryID.ToString() + "" + |
| | | ",'" + oSub.HSourceBillNo + "'" + |
| | | ",'" + oSub.HSourceBillType + "'" + |
| | | "," + oSub.HRelationQty.ToString() + "" + |
| | | "," + oSub.HRelationMoney.ToString() + |
| | | |
| | | "," + oSub.HMaterID.ToString() + "" + |
| | | "," + oSub.HUnitID.ToString() + "" + |
| | | "," + oSub.HQty.ToString() + |
| | | ",'" + oSub.HResult + "'" + |
| | | "," + oSub.HEmpID.ToString() + "" + |
| | | "," + oSub.HSourceID.ToString() + "" + |
| | | "," + oSub.HBadReasonID.ToString() + "" + |
| | | |
| | | "," + oSub.HICMOInterID.ToString() + "" + |
| | | "," + oSub.HICMOEntryID.ToString() + "" + |
| | | ",'" + oSub.HICMOBillNo + "'" + |
| | | "," + oSub.HProcExchInterID + "" + |
| | | "," + oSub.HProcExchEntryID + "" + |
| | | ",'" + oSub.HProcExchBillNo + "'" + |
| | | ",'" + oSub.HBarCode + "'" + |
| | | |
| | | "," + oSub.HReportType.ToString() + |
| | | ",'" + oSub.HAddr + "'" + |
| | | ",'" + oSub.HMaker + "'" + |
| | | ",'" + oSub.HMakeDate.ToShortDateString() + "'" + |
| | | ") "; |
| | | oCn.RunProc(subSql); |
| | | } |
| | | |
| | | //=========================ä¿ååæ§å¶ |
| | | DataSet ds2 = oCn.RunProcReturn("h_p_Sc_QualityReportBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Sc_QualityReportBill_AfterSaveCtrl"); |
| | | if (ds2 == null) |
| | | { |
| | | sReturn = "ä¿ååæ§å¶å¤æå¤±è´¥ï¼"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | sReturn = "ä¿å失败2ï¼" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]); |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | //============================ |
| | | |
| | | sReturn = "æ°å¢åæ®æåï¼"; |
| | | oCn.Commit(); |
| | | return true; |
| | |
| | | oSub.HICMOInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOInterID"]); |
| | | oSub.HICMOEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOEntryID"]); |
| | | oSub.HICMOBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HICMOBillNo"]); |
| | | oSub.HProcExchInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcExchInterID"]); |
| | | oSub.HProcExchEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcExchEntryID"]); |
| | | oSub.HProcExchBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HProcExchBillNo"]); |
| | | oSub.HReportType = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HReportType"]); |
| | | oSub.HAddr = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HAddr"]); |
| | | oSub.HMaker = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMaker"]); |