| | |
| | | file.SaveAs(ExcelPath); |
| | | |
| | | NpoiHelper np = new NpoiHelper(); |
| | | DataSet ExcelDs = np.ReadExcel(ExcelPath, 1); |
| | | DataSet ExcelDs = np.ReadExcel(ExcelPath, 1,1,"0"); |
| | | |
| | | //å 餿件 |
| | | File.Delete(ExcelPath); |
| | | |
| | | //å建临æ¶è¡¨ |
| | | DataTable tb2 = new DataTable("dt2"); |
| | | DataTable tb3 = new DataTable("dt3"); |
| | | |
| | | //æ·»å åå |
| | | for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++) |
| | |
| | | tb2.Columns.Add("HEmpID", typeof(Int32));//èå |
| | | tb2.Columns.Add("HUnitID", typeof(Int32));//计éåä½ |
| | | tb2.Columns.Add("HSourceID", typeof(Int32));//çäº§èµæºid |
| | | tb2.Columns.Add("ICMOBillHInterID", typeof(Int32));//ç产订å主id |
| | | tb2.Columns.Add("ICMOBillHEntryID", typeof(Int32));//ç产订ååid |
| | | |
| | | //æ·»å æ°æ® |
| | | for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++) |
| | |
| | | } |
| | | tb2.Rows.Add(row); |
| | | } |
| | | |
| | | ExcelDs.Tables.Add(tb2); |
| | | |
| | | var error = ""; |
| | | var ErrorResult = ""; |
| | |
| | | tb2.Rows[i]["ç©æåç§°"] = ds.Tables[0].Rows[0]["产ååç§°"].ToString(); |
| | | tb2.Rows[i]["è§æ ¼åå·"] = ds.Tables[0].Rows[0]["è§æ ¼åå·"].ToString(); |
| | | tb2.Rows[i]["HWorkShopID"] = ds.Tables[0].Rows[0]["HDeptID"].ToString(); |
| | | tb2.Rows[i]["ICMOBillHInterID"] = ds.Tables[0].Rows[0]["hmainid"].ToString();//ç产订å主id |
| | | tb2.Rows[i]["ICMOBillHEntryID"] = ds.Tables[0].Rows[0]["HEntryID"].ToString();//ç产订ååid |
| | | tb2.Rows[i]["çäº§è®¢åæ°é"] = ds.Tables[0].Rows[0]["ç产任å¡åæ°é"].ToString();//çäº§è®¢åæ°é |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList " + |
| | |
| | | tb2.Rows[i]["计éåä½"] = ds.Tables[0].Rows[0]["计éåä½"].ToString(); |
| | | tb2.Rows[i]["æ¹æ¬¡å·"] = ds.Tables[0].Rows[0]["æ¹æ¬¡"].ToString(); |
| | | tb2.Rows[i]["éå®è®¢åæ°é"] = ds.Tables[0].Rows[0]["éå®è®¢åæ°é"].ToString(); |
| | | tb2.Rows[i]["çäº§è®¢åæ°é"] = ds.Tables[0].Rows[0]["订åéæ±æ°é"].ToString(); |
| | | tb2.Rows[i]["æ»é½å¥æ°é"] = ds.Tables[0].Rows[0]["é½å¥æ°é"].ToString(); |
| | | } |
| | | else |
| | |
| | | var HUnitID = list[i]["HUnitID"].ToString(); |
| | | var HBatchNo = list[i]["æ¹æ¬¡å·"].ToString(); |
| | | var HSeOrderBillQty = list[i]["éå®è®¢åæ°é"].ToString(); |
| | | var HOrderNeedQty = list[i]["çäº§è®¢åæ°é"].ToString(); |
| | | var HPlanQty = list[i]["çäº§è®¢åæ°é"].ToString(); |
| | | var HCompleteQty = list[i]["æ»é½å¥æ°é"].ToString(); |
| | | var HOrderType = omdelMian.HOrderType; |
| | | var HDate = omdelMian.HDate; |
| | | var HMainSourceInterID = list[i]["ICMOBillHInterID"].ToString(); |
| | | var HMainSourceEntryID = list[i]["ICMOBillHEntryID"].ToString(); |
| | | |
| | | ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" + |
| | | $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"第{i + 1}è¡çäº§èµæºæéå¤,请修æ¹!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //主表 |
| | | oCN.RunProc("insert into Sc_WorkBillSortBillMain(HInterID,HBillNo,HYear,HPeriod,HBillType," + |
| | | "HBillSubType,HDate,HBillStatus,HMaker,HMakeDate,HICMOBillNo,HOrderType," + |
| | | "HICMOEntrySEQ,HWorkShopID,HSourceID, HYX, HEmpID," + |
| | | " HMaterID, HMaterName, HMaterModel, HUnitID, HBatchNo," + |
| | | " HSeOrderBillQty, HOrderNeedQty, HCompleteQty)values" + |
| | | " HSeOrderBillQty, HPlanQty, HCompleteQty,HPreparatDate," + |
| | | "HMainSourceInterID,HMainSourceEntryID)values" + |
| | | $"({HInterID},'{HBillNo}',{DateTime.Now.Year},{DateTime.Now.Month},'{BillType}'," + |
| | | $"'{BillType}',GETDATE(),1,'{user}','{HDate}','{HICMOBillNo}','{HOrderType}'," + |
| | | $"{(HICMOEntrySEQ == "" ? 0.ToString() : HICMOEntrySEQ)},{(HWorkShopID == "" ? 0.ToString() : HWorkShopID)},{(HSourceID == "" ? 0.ToString() : HSourceID)}, {(HYX == "" ? 0.ToString() : HYX)}, {(HEmpID == "" ? 0.ToString() : HEmpID)}," + |
| | | $" {(HMaterID == "" ? 0.ToString() : HMaterID)}, '{HMaterName}', '{HMaterModel}', {(HUnitID == "" ? 0.ToString() : HUnitID)}, '{HBatchNo}'," + |
| | | $" {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}, {(HOrderNeedQty == "" ? 0.ToString() : HOrderNeedQty)}, {(HCompleteQty == "" ? 0.ToString() : HCompleteQty)})"); |
| | | $" {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}, {(HPlanQty == "" ? 0.ToString() : HPlanQty)}, {(HCompleteQty == "" ? 0.ToString() : HCompleteQty)},getdate()," + |
| | | $" {HMainSourceInterID},{HMainSourceEntryID})"); |
| | | } |
| | | |
| | | for (int j = 0; j < 30; j++) |
| | | int SumDay = 31; //卿䏤æä¹å·® DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days; |
| | | |
| | | for (int j = 0; j < SumDay; j++) |
| | | { |
| | | //主表åè¡¨é½ææ°æ® |
| | | if (list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString() != "") |
| | | { |
| | | SumCount += 1; |
| | |
| | | TrueCount += 1; |
| | | } |
| | | } |
| | | //ä¸»è¡¨ææ°æ® åè¡¨æ æ°æ® |
| | | if (j == 30 && SumCount == 0 && HInterID != 0 && HBillNo != "") |
| | | { |
| | | objJsonResult = AddBillSub(HInterID.ToString(), HBillNo, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0); |
| | | } |
| | | } |
| | | } |
| | | |