森楷自动包装线同步金蝶入库申请单,如果没有审核,则在扫物料条码时自动审核;排产匹配产品器具清单,产线器具清单,器具占用时间存入数据库
2个文件已修改
162 ■■■■■ 已修改文件
WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/条码管理/WEBSController.cs 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SCGL/Èռƻ®¹ÜÀí/JIT_DayPlanPlatFormBillController.cs
@@ -3055,5 +3055,83 @@
        }
        #endregion
        #region é€šè¿‡ç‰©æ–™åŒ¹é…äº§å“å™¨å…·æ¸…单
        [Route("JIT_DayPlanPlatFormBill/GetMouldByMater")]
        [HttpGet]
        public object GetMouldByMater(string HMaterID,string HSourceID)
        {
            try
            {
                ds = oCN.RunProcReturn("exec h_p_Gy_MaterialMouldByMater " + HMaterID + "," + HSourceID, "h_p_Gy_MaterialMouldByMater");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é€šè¿‡èµ„源匹配资源器具清单
        [Route("JIT_DayPlanPlatFormBill/GetMouldBySource")]
        [HttpGet]
        public object GetMouldBySource(string HSourceID, string HMouldID)
        {
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_Gy_SourceMouldBillMainList where HSourceID = " + HSourceID + " and HMouldID = " + HMouldID, "h_v_Gy_SourceMouldBillMainList");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region æŽ’产后将器具占用时间写入数据库
        [Route("JIT_DayPlanPlatFormBill/AddMouldOccupancyTime")]
        [HttpGet]
        public object AddMouldOccupancyTime(string HMouldID, string HSourceID, string HICMOInterID, string HICMOEntryID, string HMouldPCTime)
        {
            try
            {
                ds = oCN.RunProcReturn("exec h_p_JIT_AddMouldOccupancyTime " + HMouldID + "," + HSourceID + "," + HICMOInterID + "," + HICMOEntryID + ",'" + HMouldPCTime + "'", "h_p_JIT_AddMouldOccupancyTime");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/ÌõÂë¹ÜÀí/WEBSController.cs
@@ -10360,7 +10360,7 @@
                    HSourceBillNo_TB = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSourceBillNo"]);
                    HSourceInterID = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[0]["HSourceInterID"]);
                    //根据入库申请单单号判断单据信息是否已经同步到金蝶
                    sql = string.Format(@"select FID,FBILLNO from {0}..TFKO_t_Cust100009 with(nolock) where FBILLNO = '" + HSourceBillNo_TB + "'", HDataBaseName);
                    sql = string.Format(@"select FID,FBILLNO,FDOCUMENTSTATUS from {0}..TFKO_t_Cust100009 with(nolock) where FBILLNO = '" + HSourceBillNo_TB + "'", HDataBaseName);
                    ds = oCn.RunProcReturn(sql, "TFKO_t_Cust100009");
                    //入库申请单没有同步到金蝶则进行同步
@@ -10506,10 +10506,7 @@
                                LogService.Write("发生异常,入库申请单同步获取登录账号密码失败!:" + sBarCode + "," + HSourceBillNo_TB + "," + HSourceInterID);
                                return "发生异常,入库申请单同步获取登录账号密码失败!";
                            }
                            LogService.Write("其他入库,即将登录金蝶");
                            var loginRet = InvokeHelper.Login();
                            LogService.Write("其他入库,登录金蝶结果1:" + loginRet);
                            LogService.Write("其他入库,登录金蝶结果2:" + JObject.Parse(loginRet)["LoginResultType"].Value<int>());
                            var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
                            if (isSuccess == 0)
@@ -10563,11 +10560,88 @@
                        }
                        //更新条码源单id信息
                        sql = string.Format($@"update a set HSourceInterID = isnull(b.FID,0),HSourceEntryID = isnull(c.FEntryID,0) from Gy_BarCodeBill a left join AIS20220609121235..TFKO_t_Cust100009 b on a.HSourceBillNo = b.FBillNo left join AIS20220609121235..TFKO_t_Cust_Entry100065 c on b.FID = C.FID and a.HBarcodeNo = c.FSEQ where HSourceBillNo = '{HSourceBillNo_TB}'");
                        sql = string.Format($@"update a set HSourceInterID = isnull(b.FID,0),HSourceEntryID = isnull(c.FEntryID,0) from Gy_BarCodeBill a with(nolock) left join AIS20220609121235..TFKO_t_Cust100009 b with(nolock) on a.HSourceBillNo = b.FBillNo left join AIS20220609121235..TFKO_t_Cust_Entry100065 c with(nolock) on b.FID = C.FID and a.HBarcodeNo = c.FSEQ where HSourceBillNo = '{HSourceBillNo_TB}'");
                        //执行更新语句
                        oCn.RunProc(sql);
                    }
                    //判断生产入库申请单是否是审核状态,若未审核则执行提交审核方法
                    else
                    {
                        //--Z æš‚存,A åˆ›å»ºï¼ŒB å®¡æ ¸ä¸­ï¼ŒC å·²å®¡æ ¸ï¼ŒD é‡æ–°å®¡æ ¸
                        //获取入库申请单单据号
                        string HBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["FBILLNO"]);
                        //包装线生成的生产入库申请单参与自动审核
                        if (HBillNo.Substring(0,2) == "RK" )
                        {
                            //获取入库申请单单据状态
                            string HBillStatus = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["FDOCUMENTSTATUS"]);
                            //获取入库申请单ID
                            var json = new
                            {
                                Ids = ds.Tables[0].Rows[0]["FID"].ToString(),
                            };
                            LogService.Write("提交审核ID:" + DBUtility.ClsPub.isInt(ds.Tables[0].Rows[0]["FID"]));
                            //从配置文件获取 CLOUD网址、账套信息、登录用户、登录密码
                            if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
                            {
                                LogService.Write("发生异常,入库申请单同步获取登录账号密码失败!:" + sBarCode + "," + HSourceBillNo_TB + "," + HSourceInterID);
                                return "发生异常,入库申请单同步获取登录账号密码失败!";
                            }
                            //登录金蝶
                            var loginRet = InvokeHelper.Login();
                            //判断是否登录成功
                            var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
                            if (isSuccess == 0)
                            {
                                LogService.Write("其他入库,登录金蝶失败!" + sBarCode + "," + HSourceBillNo_TB + "," + HSourceInterID);
                                return "发生异常,登录金蝶失败!";
                            }
                            //提交审核
                            string result1 = string.Empty;
                            string result2 = string.Empty;
                            //创建,重新审核状态调用提交,审核按钮
                            if (HBillStatus == "A" || HBillStatus == "D")
                            {
                                LogService.Write("生产入库申请单号:" + HBillNo + ",重新进行提交审核");
                                result1 = InvokeHelper.Submit("k18d2ab4f14034c569576ec8e0835a80c", JsonConvert.SerializeObject(json));//提交
                                result2 = InvokeHelper.Audit("k18d2ab4f14034c569576ec8e0835a80c", JsonConvert.SerializeObject(json));//审核
                                if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                                {
                                    LogService.Write("入库申请单单号:" + ",提交失败" + result1);
                                    return "发生异常,入库申请单单号:" + ",提交失败" + result1;
                                }
                                if (JObject.Parse(result2)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                                {
                                    LogService.Write("入库申请单单号:" + ",审核失败" + result2);
                                    return "发生异常,入库申请单单号:" + ",审核失败" + result2;
                                }
                            }
                            //审核中状态调用审核按钮
                            else if (HBillStatus == "B")
                            {
                                LogService.Write("生产入库申请单号:" + HBillNo + ",重新进行审核");
                                result2 = InvokeHelper.Audit("k18d2ab4f14034c569576ec8e0835a80c", JsonConvert.SerializeObject(json));//审核
                                if (JObject.Parse(result2)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                                {
                                    LogService.Write("入库申请单单号:" + ",审核失败" + result2);
                                    return "发生异常,入库申请单单号:" + ",审核失败" + result2;
                                }
                            }
                            //更新条码源单id信息
                            sql = string.Format($@"update a set HSourceInterID = isnull(b.FID,0),HSourceEntryID = isnull(c.FEntryID,0) from Gy_BarCodeBill a with(nolock) left join AIS20220609121235..TFKO_t_Cust100009 b with(nolock) on a.HSourceBillNo = b.FBillNo left join AIS20220609121235..TFKO_t_Cust_Entry100065 c with(nolock) on b.FID = C.FID and a.HBarcodeNo = c.FSEQ where HSourceBillNo = '{HSourceBillNo_TB}'");
                            //执行更新语句
                            oCn.RunProc(sql);
                        }
                    }
                }
                HReturnResult = sBarCode;