| | |
| | | List<ClsKf_ICStockBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKf_ICStockBillSub>>(entry); |
| | | |
| | | // 判断 数据库中是否存在id和单据号相等的单据,存在,则重建,只有id号相等,则申请新的id号 |
| | | // var ds1 = oCN.RunProcReturn($@" |
| | | // select hmainid HInterID, 单据号 HBillNO from h_v_Kf_POStockInBillList where hmainid = {mainList[0].HInterID} |
| | | // ", "h_v_Kf_POStockInBillList"); |
| | | // var HInterID_Old = mainList[0].HInterID; |
| | | // if (ds1.Tables[0].Rows.Count > 0 && ds1.Tables[0].Rows[0]["HInterID"] != null) |
| | | // { |
| | | // if (string.Equals(ds1.Tables[0].Rows[0]["HBillNo"].ToString(), mainList[0].HBillNo, StringComparison.OrdinalIgnoreCase)) |
| | | // { |
| | | // string sql = string.Empty; |
| | | // sql = $"delete Kf_ICStockBillMain where HinterID = {mainList[0].HInterID}"; |
| | | // oCN.RunProc(sql); |
| | | // sql = $"delete Kf_ICStockBillSub where HinterID = {mainList[0].HInterID}"; |
| | | // oCN.RunProc(sql); |
| | | // } |
| | | // else |
| | | // { |
| | | // // 重新申请HInterID |
| | | // var HInterID_Exch = DBUtility.ClsPub.CreateBillID("1201", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // mainList[0].HInterID = HInterID_Exch; |
| | | // |
| | | // foreach (var oSub in subList) |
| | | // { |
| | | // oSub.HInterID = HInterID_Exch; |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | var ds1 = oCN.RunProcReturn($@" |
| | | select hmainid HInterID, 单据号 HBillNO from h_v_Kf_POStockInBillList where hmainid = {mainList[0].HInterID} |
| | | ", "h_v_Kf_POStockInBillList"); |
| | | var HInterID_Old = mainList[0].HInterID; |
| | | if (ds1.Tables[0].Rows.Count > 0 && ds1.Tables[0].Rows[0]["HInterID"] != null) |
| | | { |
| | | if (string.Equals(ds1.Tables[0].Rows[0]["HBillNo"].ToString(), mainList[0].HBillNo, StringComparison.OrdinalIgnoreCase)) |
| | | { |
| | | string sql = string.Empty; |
| | | sql = $"delete Kf_ICStockBillMain where HinterID = {mainList[0].HInterID}"; |
| | | oCN.RunProc(sql); |
| | | sql = $"delete Kf_ICStockBillSub where HinterID = {mainList[0].HInterID}"; |
| | | oCN.RunProc(sql); |
| | | } |
| | | else |
| | | { |
| | | // 重新申请HInterID |
| | | var HInterID_Exch = DBUtility.ClsPub.CreateBillID("1201", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | mainList[0].HInterID = HInterID_Exch; |
| | | |
| | | foreach (var oSub in subList) |
| | | { |
| | | oSub.HInterID = HInterID_Exch; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | string sql = string.Empty; |
| | | sql = $"delete Kf_ICStockBillMain where HinterID = {mainList[0].HInterID}"; |
| | | oCN.RunProc(sql); |
| | | sql = $"delete Kf_ICStockBillSub where HinterID = {mainList[0].HInterID}"; |
| | | oCN.RunProc(sql); |
| | | // string sql = string.Empty; |
| | | // sql = $"delete Kf_ICStockBillMain where HinterID = {mainList[0].HInterID}"; |
| | | // oCN.RunProc(sql); |
| | | // sql = $"delete Kf_ICStockBillSub where HinterID = {mainList[0].HInterID}"; |
| | | // oCN.RunProc(sql); |
| | | // 主表插入 |
| | | oCN.RunProc($@"Insert Into Kf_ICStockBillMain |
| | | ( |