chenhaozhe
4 天以前 291fdb29daf239a13fcfb3f5e08a2f5bf9167534
WebAPI/Controllers/MJGL/Sc_MouldProdOutBillController.cs
@@ -29,7 +29,8 @@
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        public DAL.ClsSc_MouldProdOutBill oBill = new DAL.ClsSc_MouldProdOutBill();
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        #region 器具领用出库单分页列表
        [Route("Sc_MouldProdOutBillController/page")]
@@ -331,6 +332,55 @@
                objJsonResult.Message = "审核或反审核器具领用出库单失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 器具领用出库单 - 托数变更功能
        [Route("Sc_MouldProdOutBill/UpdatePallet")]
        [HttpPost]
        public object UpdatePallet([FromBody] JObject data)
        {
            try
            {
                long hmainid = data["hmainid"]?.ToObject<long>() ?? 0;
                int newPallet = data["newPallet"]?.ToObject<int>() ?? 0;
                string operatorName = data["operator"]?.ToString() ?? "";
                if (hmainid <= 0)
                    return new { code = "0", count = 0, Message = "单据ID不能为空!" };
                if (newPallet <= 0)
                    return new { code = "0", count = 0, Message = "托数必须大于0!" };
                // 直接更新托数
                string updateSql = $@"
                    UPDATE Sc_MouldStockBillMain
                    SET HPackQtys = {newPallet}
                    WHERE HInterID = {hmainid}";
                oCn.RunProc(updateSql);
                return new
                {
                    code = "1",
                    count = 1,
                    Message = "托数修改成功!"
                };
            }
            catch (Exception e)
            {
                return new
                {
                    code = "0",
                    count = 0,
                    Message = "修改失败:" + e.Message
                };
            }
        }
        #endregion
@@ -764,6 +814,26 @@
                if (bResult)
                {
                    string sReturn = "";
                    // 华舟 保存成功后下推工作联系单
                    if (oSystemParameter.ShowBill(ref sReturn) == true)
                    {
                        if (oSystemParameter.omodel.WMS_CampanyName == "华舟")
                        {
                            //自动生成工作联系单
                            var ds2 = oCn.RunProcReturn("exec h_p_OA_WorkLinkBill_Create " + oBill.omodel.HInterID + "," + 3802, "h_p_OA_WorkLinkBill_Create");
                            if (ds2 != null && ds2.Tables[0].Rows.Count > 0)
                            {
                                int HInterID = int.Parse(ds2.Tables[0].Rows[0]["NewHInterID"].ToString());
                                LogService.Write("执行消息推送..." + HInterID);
                                // 触发消息推送
                                Service.GeTuiService.PubishSingle(HInterID);
                            }
                        }
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //成功!