| | |
| | | |
| | | DAL.ClsSc_ProcessExchangeBill oBill = new DAL.ClsSc_ProcessExchangeBill(); |
| | | |
| | | string[] HBillNo = HInterID.Split(','); |
| | | string[] HInterIDs = HInterID.Split(','); |
| | | string[] HBillNos = new string[HInterIDs.Length]; |
| | | |
| | | string HBillNo_S = ""; |
| | | |
| | | foreach (var item in HBillNo) |
| | | for (int i = 0; i < HInterIDs.Length; i++) |
| | | { |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(item); |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterIDs[i]); |
| | | |
| | | DBUtility.ClsPub.HOrgID = HPRDORGID; |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据号:"+ oBill .omodel.HBillNo+ "单据ID为空!"; |
| | | objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + "单据ID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | return objJsonResult; |
| | | } |
| | | HBillNo_S += oBill.omodel.HBillNo + ","; |
| | | HBillNos[i] = oBill.omodel.HBillNo; |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | |
| | | HBillNo_S = HBillNo_S.Substring(0, HBillNo_S.Length - 1); |
| | | LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",删除工序流转卡单据:" + HBillNo_S); |
| | | |
| | | oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "删除工序流转卡单据:" + HBillNo_S + "','LMES-工序流转卡模块','" + DBUtility.ClsPub.IPAddress + "','删除单据'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | foreach (var item in HBillNo) |
| | | for (int i = 0; i < HInterIDs.Length; i++) |
| | | { |
| | | oCN.BeginTran(); |
| | | if (HSouceBillType == "SUB") { |
| | | ds = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillMain where HInterID=" + item, "Sc_ProcessExchangeBillMain"); |
| | | if (HSouceBillType == "SUB") |
| | | { |
| | | ds = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillMain where HInterID=" + HInterIDs[i], "Sc_ProcessExchangeBillMain"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) { |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=0 where HInterID=" + ds.Tables[0].Rows[0]["HMainSourceInterID"].ToString() + " and HEntryID=" + ds.Tables[0].Rows[0]["HMainSourceEntryID"].ToString()); |
| | | } |
| | | |
| | | bool IsDete = oBill.DeleteBill(long.Parse(item), ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Sc_ProcessExchangeBill_BeforeDelCtrl " + HInterIDs[i] + ",'" + HBillNos[i] + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_ProcessExchangeBill_BeforeDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | bool IsDete = oBill.DeleteBill(long.Parse(HInterIDs[i]), HBillNos[i], "h_p_Sc_ProcessExchangeBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (!IsDete) |
| | | { |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | oCN.Commit(); |
| | | } |
| | | |