|  |  |  | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //进行 会计期间 结账 的判断和控制 | 
|---|
|  |  |  | string s = ""; | 
|---|
|  |  |  | int sYear = 0; | 
|---|
|  |  |  | int sPeriod = 0; | 
|---|
|  |  |  | DateTime HDate = DateTime.Now; | 
|---|
|  |  |  | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.Message = s; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Ds = oCN.RunProcReturn("Select * from h_v_IF_BarCodeBillList Where HItemID in (" + HInterID + ")", "h_v_IF_BarCodeBillList"); | 
|---|
|  |  |  | if (Ds.Tables[0].Rows.Count != 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //保存主表 | 
|---|
|  |  |  | objJsonResult = AddBillMain(msg2); | 
|---|
|  |  |  | objJsonResult = AddBillMain(msg1); | 
|---|
|  |  |  | if (objJsonResult.code == "0") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public json AddBillMain(string msg2) | 
|---|
|  |  |  | public json AddBillMain(string msg1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
|---|
|  |  |  | string msg2 = sArray[0].ToString(); | 
|---|
|  |  |  | string msg3 = sArray[1].ToString();//模块权限 | 
|---|
|  |  |  | string msg4 = sArray[2].ToString();//当前人 | 
|---|
|  |  |  | string msg5 = sArray[3].ToString();//子表数据 | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | msg2 = "[" + msg2.ToString() + "]"; | 
|---|
|  |  |  | 
|---|
|  |  |  | int HNowSupTypeID = mainList[0].HNowSupTypeID; | 
|---|
|  |  |  | int HMadeSupID = mainList[0].HMadeSupID; | 
|---|
|  |  |  | string HMouldClass = mainList[0].HMouldClass; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int HNowWHID = mainList[0].HNowWHID; | 
|---|
|  |  |  | int HNowSPID = mainList[0].HNowSPID; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //主表 | 
|---|
|  |  |  | oCN.RunProc("Insert Into Gy_MouldFileMain   " + | 
|---|
|  |  |  | 
|---|
|  |  |  | ",HPrintQty,HMouldStatus,HWhID,HRoutingID,HCaveQty" + | 
|---|
|  |  |  | ",HBomID,HVersion,HSPGroupID,HSPID,HDesignLife,HNowSupID,HNowSupTypeID" + | 
|---|
|  |  |  | ",HUseLife,HLeaveLife,HProdQty,HProdWeight,HMouldOWNER,HSaveLife,HMouldDotCheckRuleInterID,HMouldMaintainRuleInterID,HBarCode,HMadeSupID" + | 
|---|
|  |  |  | ",HMouldClass) " + | 
|---|
|  |  |  | ",HMouldClass,HNowWHID,HNowSPID) " + | 
|---|
|  |  |  | " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + | 
|---|
|  |  |  | "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()" + | 
|---|
|  |  |  | ",'" + HMouldNo + "','" + HName + "','" + HModel + "','" + HModel2 + "','" + HDiameter + "'" + | 
|---|
|  |  |  | 
|---|
|  |  |  | "," + HPrintQty + ",'" + HMouldStatus + "'," + HWHID + "," + HRoutingID + "," + HCaveQty + | 
|---|
|  |  |  | "," + HBOMID + ",'" + HVersion + "'," + HSPGroupID + "," + HSPID + ",'" + HDesignLife + "','" + HNowSupID + "','" + HNowSupTypeID + "'" + | 
|---|
|  |  |  | ",'" + HUseLife + "','" + HLeaveLife + "','" + HProdQty + "','" + HProdWeight + "','" + HMouldOWNER + "','" + HSaveLife + "','" + HMouldDotCheckRuleInterID + "','" + HMouldMaintainRuleInterID + "','" + HBarCode + "'," + HMadeSupID + | 
|---|
|  |  |  | ",'"+ HMouldClass + "') "); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ",'"+ HMouldClass + "'," + HNowWHID + "," + HNowSPID + ") "); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //子表 | 
|---|
|  |  |  | oCN.RunProc("Insert into Gy_MouldFileSub " + | 
|---|
|  |  |  | 
|---|
|  |  |  | " values('" + HInterID + "',0,''" + | 
|---|
|  |  |  | ",0,0,'','',0,0 " + | 
|---|
|  |  |  | ") "); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult = AddBillSub(msg5,HInterID, HBillNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (objJsonResult.code == "0") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | string msg2 = sArray[0].ToString(); | 
|---|
|  |  |  | string msg3 = sArray[1].ToString();//模块权限 | 
|---|
|  |  |  | string msg4 = sArray[2].ToString();//当前人 | 
|---|
|  |  |  | string msg5 = sArray[3].ToString();//子表数据 | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log(msg3, 1, false, msg4)) | 
|---|
|  |  |  | 
|---|
|  |  |  | int HNowSupTypeID = mainList[0].HNowSupTypeID; | 
|---|
|  |  |  | int HMadeSupID = mainList[0].HMadeSupID; | 
|---|
|  |  |  | string HMouldClass = mainList[0].HMouldClass; | 
|---|
|  |  |  | int HNowWHID = mainList[0].HNowWHID; | 
|---|
|  |  |  | int HNowSPID = mainList[0].HNowSPID; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //若MAINDI重复则重新获取 | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | 
|---|
|  |  |  | ",HProdWeight=" + HProdWeight.ToString() + | 
|---|
|  |  |  | ",HBarCode='" + HBarCode.ToString() + "'" + | 
|---|
|  |  |  | ",HMadeSupID=" + HMadeSupID + | 
|---|
|  |  |  | ",HNowWHID=" + HNowWHID + | 
|---|
|  |  |  | ",HNowSPID=" + HNowSPID + | 
|---|
|  |  |  | " where HInterID=" + HInterID.ToString()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //修改子项目代码 | 
|---|
|  |  |  | //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Department,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | //将上级 为非末级 | 
|---|
|  |  |  | // oCN.RunProc("Update Gy_Department set HEndflag=0 where HItemID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | // | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc("delete from Gy_MouldFileSub_SubMater where HInterID='" + HInterID + "'"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult = AddBillSub(msg5, HInterID, HBillNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public json AddBillSub(string msg5, long HInterID, string HBillNo) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | List<Gy_MouldFileSub_SubMater> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_MouldFileSub_SubMater>>(msg5); | 
|---|
|  |  |  | int i = 0;                                          //作为子表内码 | 
|---|
|  |  |  | foreach (Gy_MouldFileSub_SubMater oSub in DetailColl) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | i++;                                            //同一个主表下的子表的内码自增 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int HEntryID = i; | 
|---|
|  |  |  | string HRemark = oSub.HRemark; | 
|---|
|  |  |  | int HMouldFileID = oSub.HMouldFileID; | 
|---|
|  |  |  | DateTime HUnionDate = oSub.HUnionDate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string sql = "insert into Gy_MouldFileSub_SubMater" + | 
|---|
|  |  |  | "(HInterID,HBillNo_bak,HEntryID,HRemark,HMouldFileID,HUnionDate) " + | 
|---|
|  |  |  | "values(" + | 
|---|
|  |  |  | "" + HInterID + | 
|---|
|  |  |  | ",'" + HBillNo + | 
|---|
|  |  |  | "'," + HEntryID + | 
|---|
|  |  |  | ",'" + HRemark + | 
|---|
|  |  |  | "','" + HMouldFileID + | 
|---|
|  |  |  | "','" + HUnionDate + | 
|---|
|  |  |  | "')"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc(sql); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = null; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 磨具档案修改按钮方法-计算下次保养/校正日期-获取档案最近一次的保养记录 | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from h_v_Gy_MouldFileList where hmainid=" + HInterID, "h_v_Gy_MouldFileList"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from h_v_Gy_MouldFile_Edit where hmainid=" + HInterID, "h_v_Gy_MouldFile_Edit"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|