chenhaozhe
3 天以前 0ecadf2d4500e018ef59c5d7c0eb3b23856580f0
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -239,19 +239,20 @@
                    }
                    //判断客户不为龙山汽配
                    if (oSystemParameter.omodel.WMS_CampanyName != "龙山汽配" && oSystemParameter.omodel.WMS_CampanyName != "瑞与祺" && oSystemParameter.omodel.WMS_CampanyName != "添康科技" && oSystemParameter.omodel.WMS_CampanyName != "海诚") //系统参数
                    {
                        if (HSourceID == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "[0000-2-006]生产资源没有选择!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //判断客户为龙山汽配
                    else if (oSystemParameter.omodel.WMS_CampanyName == "龙山汽配")
                    //if (oSystemParameter.omodel.WMS_CampanyName != "龙山汽配" && oSystemParameter.omodel.WMS_CampanyName != "瑞与祺" && oSystemParameter.omodel.WMS_CampanyName != "添康科技" && oSystemParameter.omodel.WMS_CampanyName != "海诚") //系统参数
                    //{
                    //    if (HSourceID == 0)
                    //    {
                    //        objJsonResult.code = "0";
                    //        objJsonResult.count = 0;
                    //        objJsonResult.Message = "[0000-2-006]生产资源没有选择!";
                    //        objJsonResult.data = null;
                    //        return objJsonResult;
                    //    }
                    //}
                    ////判断客户为龙山汽配
                    //else
                    if (oSystemParameter.omodel.WMS_CampanyName == "龙山汽配")
                    {
                        //判断是否为多工位
                        ds = oCN.RunProcReturn("select * from h_v_GetStationOutBill_Detail where 工序ID = " + HProcID + " and 物料ID = " + HMaterID + " and 流转卡号 = '" + HProcExchBillNo + "'", "h_v_GetStationOutBill_Detail");
@@ -1408,12 +1409,12 @@
                    return objJsonResult;
                }
                if (totalWeight <= 0)
                if (totalWeight < 0)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!重量必须大于0";
                    objJsonResult.Message = "保存失败!重量必须大于等于0";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
@@ -2655,14 +2656,17 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HChecker != "")
                    if (oSystemParameter.omodel.WMS_CampanyName != "华舟")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "[0000-1-013]单据已经审核,不能删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                        if (oBill.omodel.HChecker != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "[0000-1-013]单据已经审核,不能删除!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    ds = oCn.RunProcReturn($"exec h_p_DelOutInBill {HInterID},'MES_StationOutBill_DeleteRelationCtl'", "h_p_DelOutInBill");
@@ -3792,15 +3796,15 @@
        #region 工序汇报单获取对应所以序列
        [Route("Cj_StationOutBill/getAllHSEQ")]
        [HttpGet]
        public object getAllHSEQ(string HInterID)
        public object getAllHSEQ(int HInterID)
        {
            try
            {
                //得到信息(委外标记为0时,流转标记为1时
                ds = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillSEQ  where HInterID= " + HInterID, "Sc_ProcessExchangeBillSEQ");
                DataSet DS = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillSEQ  where HInterID= " + HInterID, "Sc_ProcessExchangeBillSEQ");
                
                //写入信息
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                if (DS == null || DS.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -3811,7 +3815,7 @@
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "[0000-1-037]Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.data = DS.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
@@ -4879,6 +4883,7 @@
        #endregion
        #region 工序汇报,审核前修改
        //审核,带编辑功能
        [Route("Cj_StationOutBill/setOtherProperty")]
        [HttpPost]
@@ -5031,5 +5036,106 @@
                return objJsonResult;
            }
        }
        #endregion
        #region 工序汇报自动生成进站接收单
        //工序汇报开工按钮自动开工
        [Route("Cj_StationOutBill/startTranslating")]
        [HttpGet]
        public object startTranslating(int HProcExchInterID,int HProcExchEntryID,int HOrgID,int HProcNo,string user)
        {
            try
            {
                oCN.BeginTran();
                //判断是否有编辑权限
                if (!DBUtility.ClsPub.Security_Log("Cj_StationInBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[3790-2-003]开工单无编辑权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string HBillType = "3790";
                string HBillNo = "";
                Int64 HInterID = 0;//显示的字段
                HInterID = DBUtility.ClsPub.CreateBillID(HBillType, ref DBUtility.ClsPub.sExeReturnInfo);
                HBillNo = DBUtility.ClsPub.CreateBillCode(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
                int HBillStatus = 0;
                string HMaker = user;
                int HYear = DateTime.Now.Year;
                double HPeriod = DateTime.Now.Month;
                string HRemark = "出战汇报单自动开工";//备注
                long HICMOInterID = 0;//任务单ID
                string HICMOBillNo = "";//任务单
                long HProcPlanInterID = 0;
                long HProcPlanEntryID = 0;
                string HProcPlanBillNo = "";
                long HMaterID = 1;//产品ID
                long HProcID = 1;//当前工序
                double HICMOQty = 0;//任务单数量
                double HPlanQty = 0;//流转卡数量
                long HSourceID = 0;//生产资源ID
                long HGroupID = 0;//班组ID
                long HDeptID = 0;
                long HEmpID = 0;//接收人ID
                string HBarCode = "";//条形码
                string HAddr = "";
                string HBarCodeMaker = "";
                long HSupID = 0;
                double HQty = 0;//接收数量
                double HPrice = 0;
                double HMoney = 0;
                double HPieceQty = 0;//接收件数
                string HSourceName = "";//生产资源名称
                long HCenterID = 0;//工作中心ID
                string HOrderProcNO = "";//订单跟踪号
                long HPRDOrgID = HOrgID;//组织ID
                double HmaterOutqty = 0;//白坯发布
                string HProcExchBillNo = "";//上料防错单单据号
                int HMainInterID = 0;//白坯发布
                oCN.RunProc("Insert Into Sc_StationInBillMain " +
                    "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
                    ",HYear,HPeriod,HRemark" +
                    ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
                    ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationInTime,HSourceID" +
                    ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
                    ",HSupID,HQty,HPrice,HMoney,HPieceQty,HSourceName,HCenterID" +
                    ",HProcNo,HOrderProcNO,HMainInterID,HPRDOrgID" +
                    ",HmaterOutqty" +
                    ") " +
                    " values('" + HBillType + "','" + (HBillType) + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" +
                    "," + HYear + "," + HPeriod + ",'" + HRemark + "'" +
                    "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID +
                    ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID +
                    "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" +
                    "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HPieceQty + ",'" + HSourceName + "'," + HCenterID +
                    ",'" + HProcNo + "','" + HOrderProcNO + "','" + HMainInterID + "'," + HPRDOrgID +
                    "," + HmaterOutqty + ") ");
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "开工失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}