| | |
| | | { |
| | | try |
| | | { |
| | | //ä¿ååæ§å¶========================================= |
| | | string HBillNote = ""; |
| | | DataSet ds = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Xs_SeOrderChangeBill_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(); |
| | | //æ´æ°ä¸»è¡¨ |
| | | string mainSql = "update Xs_SeOrderChangeBillMain set " + |
| | |
| | | { |
| | | string subSql = "insert into Xs_SeOrderChangeBillSub" + |
| | | "(HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | ",HMaterID,HUnitID,HQty_Old,HQty_New,HTaxPrice_Old,HTaxPrice_New,HDate_Old,HDate_New) " + |
| | | ",HMaterID,HUnitID,HQty_Old,HQty_New,HTaxRate_Old,HTaxRate_New,HTaxPrice_Old,HTaxPrice_New,HDate_Old,HDate_New) " + |
| | | " values(" + |
| | | "" + omodel.HInterID.ToString() + |
| | | "," + oSub.HEntryID.ToString() + |
| | |
| | | "," + oSub.HUnitID + |
| | | "," + oSub.HQty_Old + |
| | | "," + oSub.HQty_New + |
| | | "," + oSub.HTaxRate_Old + |
| | | "," + oSub.HTaxRate_New + |
| | | "," + oSub.HTaxPrice_Old + |
| | | "," + oSub.HTaxPrice_New + |
| | | ",'" + oSub.HDate_Old + "'" + |
| | |
| | | ")"; |
| | | oCn.RunProc(subSql); |
| | | } |
| | | |
| | | |
| | | //ä¿ååæ§å¶========================================= |
| | | DataSet ds2 = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_AfterSaveCtrl " + omodel.HInterID.ToString(), "h_p_Xs_SeOrderChangeBill_AfterSaveCtrl"); |
| | | if (ds2 == null) |
| | | { |
| | | sReturn = "ä¿ååå¤æå¤±è´¥ï¼"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]); |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | //========================================================= |
| | | |
| | | sReturn = "ä¿®æ¹åæ®æåï¼"; |
| | | oCn.Commit(); |
| | | return true; |
| | |
| | | omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | |
| | | |
| | | //ä¿ååæ§å¶========================================= |
| | | string HBillNote = ""; |
| | | DataSet ds = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Xs_SeOrderChangeBill_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(); |
| | | //æå
¥ä¸»è¡¨ |
| | |
| | | { |
| | | string subSql = "insert into Xs_SeOrderChangeBillSub" + |
| | | "(HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | ",HMaterID,HUnitID,HQty_Old,HQty_New,HTaxPrice_Old,HTaxPrice_New,HDate_Old,HDate_New) " + |
| | | ",HMaterID,HUnitID,HQty_Old,HQty_New,HTaxRate_Old,HTaxRate_New,HTaxPrice_Old,HTaxPrice_New,HDate_Old,HDate_New) " + |
| | | " values(" + |
| | | "" + omodel.HInterID.ToString() + |
| | | "," + oSub.HEntryID.ToString() + |
| | |
| | | "," + oSub.HUnitID + |
| | | "," + oSub.HQty_Old + |
| | | "," + oSub.HQty_New + |
| | | "," + oSub.HTaxRate_Old + |
| | | "," + oSub.HTaxRate_New + |
| | | "," + oSub.HTaxPrice_Old + |
| | | "," + oSub.HTaxPrice_New + |
| | | ",'" + oSub.HDate_Old + "'" + |
| | |
| | | } |
| | | |
| | | //ä¿ååæ§å¶========================================= |
| | | DataSet ds = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_AfterSaveCtrl " + omodel.HInterID.ToString(), "h_p_Xs_SeOrderChangeBill_AfterSaveCtrl"); |
| | | if (ds == null) |
| | | DataSet ds2 = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_AfterSaveCtrl " + omodel.HInterID.ToString(), "h_p_Xs_SeOrderChangeBill_AfterSaveCtrl"); |
| | | if (ds2 == null) |
| | | { |
| | | sReturn = "ä¿ååå¤æå¤±è´¥ï¼"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | sReturn = "ä¿å失败ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]); |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | //========================================================= |
| | |
| | | //=================================================== |
| | | oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); |
| | | oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); |
| | | oSub.HQty_Old = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HQty_Old"]); |
| | | oSub.HQty_New = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HQty_New"]); |
| | | oSub.HTaxPrice_Old = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HTaxPrice_Old"]); |
| | | oSub.HTaxPrice_New = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HTaxPrice_New"]); |
| | | oSub.HQty_Old = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty_Old"]); |
| | | oSub.HQty_New = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty_New"]); |
| | | oSub.HTaxPrice_Old = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HTaxPrice_Old"]); |
| | | oSub.HTaxPrice_New = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HTaxPrice_New"]); |
| | | oSub.HDate_Old = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HDate_Old"]); |
| | | oSub.HDate_New = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HDate_New"]); |
| | | |