wtt
2024-08-07 c2ef1e65edb97ddbd00cc130e9f4dd9d47e0252d
WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
@@ -119,6 +119,7 @@
                double HPeriod = DateTime.Now.Month;
                string HRemark = list[0].HRemark;//备注
                long HICMOInterID = list[0].HICMOInterID;//任务单ID
                long HICMOEntryID = list[0].HICMOEntryID;//任务单子ID
                string HICMOBillNo = list[0].HICMOBillNo;//任务单
                long HProcPlanInterID = 0;
                long HProcPlanEntryID = 0;
@@ -144,6 +145,8 @@
                string HOrderProcNO = list[0].HOrderProcNO;//订单跟踪号
                long HPRDOrgID = list[0].HPRDOrgID;//组织ID
                double HmaterOutqty = list[0].HmaterOutqty;//白坯发布
                long HMaterToSourceInterID = list[0].HMaterToSourceInterID;//上料防错单ID
                string HMaterToSourceBillNo = list[0].HMaterToSourceBillNo;//上料防错单单据号
                //单据完整性判断
                if (HMaterID <= 0)
                {
@@ -260,6 +263,29 @@
                    ",'" + HProcNo + "','" + HOrderProcNO + "','" + HMainInterID + "'," + HPRDOrgID +
                    ","+ HmaterOutqty + ") ");
                    if(HMaterToSourceInterID!=0)
                    {
                        //生成上料防错单
                        //插入子表
                        oCN.RunProc("EXEC h_p_Sc_MaterToSourceBillSub_Insert " + HMaterToSourceInterID.ToString() + ",'" + HMaterToSourceBillNo + "'");
                        //插入主表
                        oCN.RunProc("Insert Into Sc_MaterToSourceBillMain   " +
                        "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                        ",HYear,HPeriod,HRemark,HMaker,HMakeDate,HChecker,HCheckDate" +
                        ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
                        ",HProcExchInterID,HProcExchEntryID,HProcExchBillNo,HICMOInterID,HICMOEntryID,HICMOBillNo" +
                        ",HSourceID,HProcID,HMaterID,HSourceBarCode,HEquipID,HWorkerID,HWorkerBarCode" +
                        ",HGroupID,HProcNo,HStockOrgID" +
                        ") " +
                        " values('3786','3790'," + HMaterToSourceInterID.ToString() + ",'" + HMaterToSourceBillNo + "',convert(varchar(10),getdate(),120)" +
                        ",year(getdate()),month(getdate()),'工序进站绑定生成','" + HMaker + "',getdate(),'" + HMaker + "',getdate()" +
                        "," + HInterID.ToString() + ",0,'" + HBillNo + "','3790'" +
                        "," + HProcExchInterID.ToString() + "," + HProcExchEntryID.ToString() + ",'" + HProcExchBillNo + "'," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "'" +
                        "," + HSourceID.ToString() + "," + HProcID.ToString() + "," + HMaterID.ToString() + ",'',0,0,''" +
                        "," + HGroupID.ToString() + "," + HProcNo.ToString() + "," + HPRDOrgID.ToString() +
                        ") ");
                    }
                    //写入日志
                    LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",新增工序进站单据:" + HBillNo);
                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "新增工序进站单据:" + HBillNo + "','LMES-工序进站模块','" + DBUtility.ClsPub.IPAddress + "','新增单据'", ref DBUtility.ClsPub.sExeReturnInfo);
                }
@@ -423,6 +449,67 @@
        }
        #endregion
        #region 工序进站接收单流水号回车获取工序信息,并根据系统参数判断进站单是否绑定配件清单 20240621
        [Route("Cj_StationInBill/HProcNo_KeyDown")]
        [HttpGet]
        public object HProcNo_KeyDown(string HBillNo, string HProcExchBillNo, Int64 HProcNo, string HMaker)
        {
            try
            {
                if (HProcExchBillNo.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "流转卡没有扫描,或者没有按回车键,请扫描流转卡或在流转卡文本框中按回车键!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //获取系统参数
                string sErrMsg = "";
                if (oSystemParameter.ShowBill(ref sErrMsg) == true)
                {
                    string MES_StationInBill_LineBindCtl = "N"; //进站接收时是否绑定该工序的配件清单(Y是需要绑定,N不需要绑定)
                    string MES_StationInBill_DefQty = "4";      //工序进站时默认带入数量(1.流转卡数,2.上道合格数量,3.物料最小包装数量,4.不带入)
                    MES_StationInBill_LineBindCtl = oSystemParameter.omodel.MES_StationInBill_LineBindCtl;
                    MES_StationInBill_DefQty = oSystemParameter.omodel.MES_StationInBill_DefQty;
                    ds = oCN.RunProcReturn("exec h_p_MES_StationInBill_HProcNo_KeyDown '" + HBillNo + "','" + HProcExchBillNo + "'," + HProcNo.ToString() + ",'" + MES_StationInBill_LineBindCtl + "','" + MES_StationInBill_DefQty + "','" + HMaker + "'", "h_p_MES_StationInBill_HProcNo_KeyDown");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "工序号错误或者当前工序号不允许进站,请重新输入!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "获取系统参数失败! " + sErrMsg;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "工序进站接收单流水号获取信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 工序进站接收单流水号回车获取工序信息
        [Route("Cj_StationInBill/txtHProcNo_KeyDown")]
        [HttpGet]