|  |  |  | 
|---|
|  |  |  | websLsmain.HDeptID = lsmain[0].HDeptID; | 
|---|
|  |  |  | websLsmain.HWHID = lsmain[0].HWHID; | 
|---|
|  |  |  | websLsmain.HSCWHID = 0; | 
|---|
|  |  |  | //websLsmain.HSPID = lsmain[0].HSPID; | 
|---|
|  |  |  | websLsmain.HSupID = lsmain[0].HSupID; | 
|---|
|  |  |  | websLsmain.HKeeperID = lsmain[0].HKeeperID; | 
|---|
|  |  |  | websLsmain.HSecManagerID = lsmain[0].HSecManagerID; | 
|---|
|  |  |  | 
|---|
|  |  |  | websLsmain.HManagerID = 0; | 
|---|
|  |  |  | websLsmain.HBillerID = lsmain[0].HBillerID; | 
|---|
|  |  |  | websLsmain.HRemark = ""; | 
|---|
|  |  |  | websLsmain.HExplanation = lsmain[0].HExplanation; | 
|---|
|  |  |  | websLsmain.HInnerBillNo = ""; | 
|---|
|  |  |  | websLsmain.HRedBlueFlag = false;//false蓝字 true红字 | 
|---|
|  |  |  | websLsmain.HMainSourceBillType = lsmain[0].HBillType; | 
|---|
|  |  |  | websLsmain.HExplanation = lsmain[0].HExplanation; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | websLsmain.HMaker = lsmain[0].HMaker; | 
|---|
|  |  |  | websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID; | 
|---|
|  |  |  | websLsmain.HOWNERID = lsmain[0].HSTOCKORGID; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (webserver.set_SavePOStockInBill_New(websLsmain, sSourceBillType, ref DBUtility.ClsPub.sErrInfo)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | string sql = $"select * from H_v_SRM_POInStockBillList where 单据号 ='{HBillno}'"; | 
|---|
|  |  |  | ds = oCn.RunProcReturn(sql, "H_v_SRM_POInStockBillList"); | 
|---|
|  |  |  | if (ds == null || ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有返回任何记录!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | json result = Get_ReciveBillCheckDate(HBillno); | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | //string sql = $"select * from H_v_SRM_POInStockBillList where 单据号 ='{HBillno}'"; | 
|---|
|  |  |  | //ds = oCn.RunProcReturn(sql, "H_v_SRM_POInStockBillList"); | 
|---|
|  |  |  | //if (ds == null || ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    objJsonResult.code = "0"; | 
|---|
|  |  |  | //    objJsonResult.count = 0; | 
|---|
|  |  |  | //    objJsonResult.Message = "没有返回任何记录!"; | 
|---|
|  |  |  | //    objJsonResult.data = null; | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //else | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    objJsonResult.code = "1"; | 
|---|
|  |  |  | //    objJsonResult.count = 1; | 
|---|
|  |  |  | //    objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | //    objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | DataTable dt = new DataTable(); | 
|---|
|  |  |  | List<string> fidList = new List<string>(); | 
|---|
|  |  |  | if (FCusName == "瑞与祺") | 
|---|
|  |  |  | if (FCusName == "瑞与祺" || FCusName == "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | sql = string.Format(@" | 
|---|
|  |  |  | SELECT T3.FNAME AS FTYPENAME,M.HBILLNO,B.HINTERID,B.HENTRYID,C.FID,C.FENTRYID, D.FBILLNO,B.HQTY,CD.FRECEIVEORGID,CDOO.FNUMBER AS FRECEIVENUMBER | 
|---|
|  |  |  | 
|---|
|  |  |  | LEFT JOIN {0}..T_ORG_ORGANIZATIONS CROO ON CR.FSETTLEORGID = CROO.FORGID | 
|---|
|  |  |  | LEFT JOIN {0}..T_PUR_POORDER D ON C.FID =D.FID | 
|---|
|  |  |  | LEFT JOIN {0}..T_BAS_BILLTYPE T2 ON D.FBILLTYPEID = T2.FBILLTYPEID | 
|---|
|  |  |  | LEFT JOIN {0}..T_BAS_BILLTYPE_L T3 ON T2.FBILLTYPEID = T3.FBILLTYPEID | 
|---|
|  |  |  | LEFT JOIN {0}..T_BAS_BILLTYPE_L T3 ON T2.FBILLTYPEID = T3.FBILLTYPEID and FLOCALEID=2052 | 
|---|
|  |  |  | LEFT JOIN  {0}..V_BD_BUYER T4 ON D.FPURCHASERID =T4.FID | 
|---|
|  |  |  | LEFT JOIN {0}..T_BD_SUPPLIER DS ON D.FSUPPLIERID = DS.FSUPPLIERID | 
|---|
|  |  |  | LEFT JOIN {0}..T_ORG_ORGANIZATIONS DOO ON D.FPURCHASEORGID = DOO.FORGID | 
|---|
|  |  |  | 
|---|
|  |  |  | model.Add("FPurOrgId", new JObject() { ["Fnumber"] = dr["FPURCHASEORGNUMBER"].ToString() }); //采购组织 | 
|---|
|  |  |  | model.Add("FSupplierId", new JObject() { ["Fnumber"] = dr["FSUPPLIERNUMBER"].ToString() }); //供应商 | 
|---|
|  |  |  | model.Add("FPURCHASERID", new JObject() { ["Fnumber"] = dr["FPURCHASERNUMBER"].ToString() }); //采购员 | 
|---|
|  |  |  | //model.Add("F_xbkf_Base", new JObject() { ["Fnumber"] = dr["FRECEIVEMENNUMBER"].ToString() }); //收料员 | 
|---|
|  |  |  | model.Add("FOwnerTypeIdHead", "BD_Supplier");//  货主类型 | 
|---|
|  |  |  | model.Add("FOwnerIdHead", new JObject() { ["Fnumber"] = dr["FSUPPLIERNUMBER"].ToString() });//货主 供应商 | 
|---|
|  |  |  | //model.Add("F_XBKF_COMBO", dr["F_xbkf_Combo1"].ToString());//是否有票 | 
|---|
|  |  |  | JArray Fentity = new JArray(); | 
|---|
|  |  |  | foreach (var item in drs) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | var loginRet = InvokeHelper.Login(); | 
|---|
|  |  |  | var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); | 
|---|
|  |  |  | if (isSuccess == 0) | 
|---|
|  |  |  | if (isSuccess <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objjson.code = "0"; | 
|---|
|  |  |  | objjson.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | JOIN {0}..T_PUR_POORDERENTRY_F CR ON    C.FENTRYID = CR.FENTRYID | 
|---|
|  |  |  | LEFT JOIN {0}..T_ORG_ORGANIZATIONS CROO ON CR.FSETTLEORGID = CROO.FORGID | 
|---|
|  |  |  | LEFT JOIN {0}..T_PUR_POORDER D ON C.FID =D.FID | 
|---|
|  |  |  | LEFT JOIN {0}..T_BAS_BILLTYPE T2 ON D.FBILLTYPEID = T2.FBILLTYPEID | 
|---|
|  |  |  | LEFT JOIN {0}..T_BAS_BILLTYPE_L T3 ON T2.FBILLTYPEID = T3.FBILLTYPEID | 
|---|
|  |  |  | LEFT JOIN {0}..T_BAS_BILLTYPE T2 ON D.FBILLTYPEID = T2.FBILLTYPEID | 
|---|
|  |  |  | LEFT JOIN {0}..T_BAS_BILLTYPE_L T3 ON T2.FBILLTYPEID = T3.FBILLTYPEID  and FLOCALEID=2052 | 
|---|
|  |  |  | LEFT JOIN  {0}..V_BD_BUYER T4 ON D.FPURCHASERID =T4.FID | 
|---|
|  |  |  | LEFT JOIN  {0}..T_HR_EMPINFO T5 ON D.F_XBKF_BASE1 = T5.FID | 
|---|
|  |  |  | LEFT JOIN {0}..T_BD_SUPPLIER DS ON D.FSUPPLIERID = DS.FSUPPLIERID | 
|---|
|  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | var loginRet = InvokeHelper.Login(); | 
|---|
|  |  |  | var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); | 
|---|
|  |  |  | if (isSuccess == 0) | 
|---|
|  |  |  | if (isSuccess < 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objjson.code = "0"; | 
|---|
|  |  |  | objjson.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | objjson.data = null; | 
|---|
|  |  |  | return objjson; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | LogService.Write("jsonRoot:" + jsonRoot.ToString()); | 
|---|
|  |  |  | //LogService.Write("jsonRoot:" + jsonRoot.ToString()); | 
|---|
|  |  |  | var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString()); | 
|---|
|  |  |  | //LogService.Write(result); | 
|---|
|  |  |  | if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE") | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var check = Get_ReciveBillCheckDate(HBillNo); | 
|---|
|  |  |  | var check = Exec_ReciveBillCheck(HBillNo); | 
|---|
|  |  |  | if (check.code == "0") | 
|---|
|  |  |  | return check; | 
|---|
|  |  |  | //if(check) | 
|---|
|  |  |  | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objjson.code = "0"; | 
|---|
|  |  |  | objjson.count = 0; | 
|---|
|  |  |  | objjson.count = 0; | 
|---|
|  |  |  | objjson.Message = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); | 
|---|
|  |  |  | objjson.data = null; | 
|---|
|  |  |  | return objjson; | 
|---|
|  |  |  | 
|---|
|  |  |  | objjson.Message = "没有返回任何记录!" + e.ToString(); | 
|---|
|  |  |  | objjson.data = null; | 
|---|
|  |  |  | return objjson; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //收料通知单审核 审核提交 | 
|---|
|  |  |  | [Route("POStockInBillList/Exec_ReciveBillCheck")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object Exec_ReciveBillCheck(string HBarCode) | 
|---|
|  |  |  | public json Exec_ReciveBillCheck(string HBarCode) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | json objjson = new json(); | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //修改金蝶生产单的状态 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (isSuccess == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "操作失败,金蝶账号登录异常。" + loginRet; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | objjson.code = "0"; | 
|---|
|  |  |  | objjson.count = 0; | 
|---|
|  |  |  | objjson.Message = "操作失败,金蝶账号登录异常。" + loginRet; | 
|---|
|  |  |  | objjson.data = null; | 
|---|
|  |  |  | return objjson; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var json = new | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | //判断审核是否成功 | 
|---|
|  |  |  | if (JObject.Parse(result2)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核收料通知单失败!单据号:" + HBarCode; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | objjson.code = "0"; | 
|---|
|  |  |  | objjson.count = 0; | 
|---|
|  |  |  | objjson.Message = "审核收料通知单失败!单据号:" + HBarCode; | 
|---|
|  |  |  | objjson.data = null; | 
|---|
|  |  |  | return objjson; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "审核成功!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | return objjson; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | objjson.code = "0"; | 
|---|
|  |  |  | objjson.count = 0; | 
|---|
|  |  |  | objjson.Message = "没有返回任何记录!" + e.ToString(); | 
|---|
|  |  |  | objjson.data = null; | 
|---|
|  |  |  | return objjson; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|