| | |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Data.SqlClient; |
| | | using System.IO; |
| | | using System.Web.Http; |
| | | using WebAPI.DLL; |
| | | using WebAPI.Models; |
| | | using WebAPI.Service; |
| | | using Kingdee.BOS.WebApi.Client; |
| | | |
| | | namespace WebAPI.Controllers |
| | | { |
| | |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus; |
| | | |
| | | private json objJsonResult = new json(); |
| | | |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | |
| | | FentityModel.Add("FCostRate", dr1["FCostRate"].ToString());// 成本权重 |
| | | FentityModel.Add("FISBACKFLUSH", dr1["FISBACKFLUSH"].ToString() == "1" ? true : false);// 倒冲领料 |
| | | FentityModel.Add("FMOMAINENTRYID", dr1["FMOENTRYID"].ToString());// |
| | | FentityModel.Add("F_bsv_Base1", new JObject() { ["Fnumber"] = dr1["FPREBDONENUMBER"].ToString() }); //包装标识 |
| | | //FentityModel.Add("F_bsv_Base1", new JObject() { ["Fnumber"] = dr1["FPREBDONENUMBER"].ToString() }); //包装标识 |
| | | FentityModel.Add("FLot", new JObject() { ["FNumber"] = dr1["FBATCHNO"].ToString() }); //批号 |
| | | FentityModel.Add("F_bsv_Text", dr1["工序流转卡号"].ToString()); //流转卡号 |
| | | JArray Fentity2 = new JArray(); |
| | |
| | | FentityModel.Add("FBaseRealQty", item["数量"].ToString());// |
| | | FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");// |
| | | FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["HPrdOrgNumber"].ToString() });// |
| | | FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 仓库 |
| | | string sErr = ""; |
| | | if (oSystemParameter.ShowBill(ref sErr)) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "瑞与祺") |
| | | { |
| | | if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "工艺路线") |
| | | { |
| | | FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumbers"].ToString() }); // 仓库 |
| | | } |
| | | else if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "工序") |
| | | { |
| | | FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 仓库 |
| | | } |
| | | } |
| | | } |
| | | FentityModel.Add("FLot", new JObject() { ["FNumber"] = item["HBatchNo"].ToString() }); //批号 |
| | | FentityModel.Add("FISBACKFLUSH", "true");// |
| | | FentityModel.Add("FWorkShopId1", new JObject() { ["FNumber"] = item["HWorkShopNumber"].ToString() }); // 生产车间 |
| | |
| | | FentityModel.Add("FBaseRealQty", item["数量"].ToString());// |
| | | FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");// |
| | | FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["HPrdOrgNumber"].ToString() });// |
| | | FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 仓库 |
| | | string sErr = ""; |
| | | if (oSystemParameter.ShowBill(ref sErr)) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "瑞与祺") |
| | | { |
| | | if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "工艺路线") |
| | | { |
| | | FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumbers"].ToString() }); // 仓库 |
| | | } |
| | | else if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "工序") |
| | | { |
| | | FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 仓库 |
| | | } |
| | | } |
| | | } |
| | | FentityModel.Add("FLot", new JObject() { ["FNumber"] = item["HBatchNo"].ToString() }); //批号 |
| | | FentityModel.Add("FISBACKFLUSH", "true");// |
| | | FentityModel.Add("FWorkShopId1", new JObject() { ["FNumber"] = item["HWorkShopNumber"].ToString() }); // 生产车间 |
| | |
| | | Int64 HSourceEntryID, string HSourceBillNo, string user, |
| | | Int64 HWHID, Int64 HSPID, Int64 HSupID, Int64 HKeeperID, |
| | | Int64 HMaterID, string HSourceBillType, Int64 HSLInterID, |
| | | Int64 HSLEntryID, string HSLBillNo, Int64 HSLSeQ) |
| | | Int64 HSLEntryID, string HSLBillNo, Int64 HSLSeQ, string HBillNo, Int64 HInterID) |
| | | { |
| | | try |
| | | { |
| | | //获取生产汇报单最大InterID和单据号 |
| | | Int64 HInterID = DBUtility.ClsPub.CreateBillID("7503", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string HBillNo = DBUtility.ClsPub.CreateBillCode("7503", ref DBUtility.ClsPub.sExeReturnInfo, true); |
| | | |
| | | //Int64 HInterID = DBUtility.ClsPub.CreateBillID("7503", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //string HBillNo = DBUtility.ClsPub.CreateBillCode("7503", ref DBUtility.ClsPub.sExeReturnInfo, true); |
| | | |
| | | DataSet ds1 = oCN.RunProcReturn("select * from MES_AccessoriesList where HSourceBillNo = '" + HBillNo + "'", "MES_AccessoriesList"); |
| | | string HFileName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFileName"]); |
| | | string HFilePath = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFilePath"]); |
| | | |
| | | |
| | | |
| | | string path = HFilePath; |
| | | FileInfo fi = new FileInfo(path); |
| | | long len = fi.Length; |
| | | byte[] buffer = new byte[len]; |
| | | FileStream fs = new FileStream(path, FileMode.Open); |
| | | fs.Read(buffer, 0, (int)len); |
| | | //文件IO流 |
| | | string a = Convert.ToBase64String(buffer); |
| | | |
| | | |
| | | //保存 |
| | | oCN.BeginTran(); |
| | | //生产汇报单主表 |
| | |
| | | model.Add("FSourceOrgId", new JObject() { ["Fnumber"] = HZJOrgNumber.ToString() }); //来源组织 |
| | | model.Add("FInspectOrgId", new JObject() { ["Fnumber"] = HZJOrgNumber.ToString() }); //质检组织 |
| | | model.Add("FISSYNCED", "false");// 是否已同步 |
| | | model.Add("F_PGKJ_Date", DateTime.Now.ToString("yyyy-MM-dd"));// 报检日期 |
| | | model.Add("FBillNo", HBillNo); |
| | | |
| | | JArray Fentity = new JArray(); |
| | |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"来料检验单同步金蝶云失败!单号:{HBillNo.ToString()}" + result; |
| | | objJsonResult.Message = $"来料检验单同步金蝶云失败!单号:{HBillNo.ToString()}" + jsonRoot; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | Ids = fID, |
| | | }; |
| | | |
| | | K3CloudApiClient client = new K3CloudApiClient("http://192.168.80.90/k3cloud/"); |
| | | |
| | | |
| | | |
| | | result1 = InvokeHelper.Submit("QM_InspectBill", JsonConvert.SerializeObject(json));//提交 |
| | | result2 = InvokeHelper.Audit("QM_InspectBill", JsonConvert.SerializeObject(json));//提交 |
| | | if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | { |
| | | string jsonStr = "{" + |
| | | " \"FileName\":\"" + HFileName + "\"," + |
| | | " \"FormId\":\"QM_InspectBill\"," + |
| | | " \"IsLast\":\"true\"," + |
| | | " \"InterId\":\"" + HInterID + "\"," + |
| | | " \"BillNO\":\"" + HBillNo + "\"," + |
| | | " \"AliasFileName\":\"test\"," + |
| | | " \"SendByte\":\"" + a + "\"," + |
| | | "}"; |
| | | |
| | | var ret = client.AttachmentUpload(jsonStr); |
| | | |
| | | |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | string HBillNo = DBUtility.ClsPub.CreateBillCode("7501", ref DBUtility.ClsPub.sExeReturnInfo, true); |
| | | |
| | | //保存 |
| | | oCN.BeginTran(); |
| | | //oCN.BeginTran(); |
| | | //生成产品检验单 |
| | | //oCN.RunProc("Insert Into QC_POStockInCheckBillMain " + |
| | | //"(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HBillStatus,HChecker,HCheckDate" + |
| | |
| | | //FentityModel.Add("FReferDetail", Fentity3); |
| | | Fentity.Add(FentityModel); |
| | | model.Add("FEntity", Fentity); //明细信息 |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds = oCN.RunProcReturn("select HCheckdate from Sc_ProcessReportMain where hbillno = '" + HSourceBillNo + "'", "Sc_ProcessReportMain"); |
| | | DateTime HCheckDate = DBUtility.ClsPub.isDate(ds.Tables[0].Rows[0]["HCheckdate"]); |
| | | JObject jsonRoot = new JObject() |
| | | { |
| | | ["Creator"] = "", |
| | |
| | | ["IsDeleteEntry"] = "false", |
| | | ["SubSystemId"] = "", |
| | | ["IsVerifyBaseDataField"] = "false", |
| | | ["F_PGKJ_Date"] = HCheckDate.ToString(), |
| | | //["IsAutoSubmitAndAudit"] = true,//自动调用提交和审核功能 |
| | | ["Model"] = model |
| | | }; |