YL
2021-09-06 28f99afc92f67b372df91f1205a3dd8c2ff7be6e
WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs
@@ -18,6 +18,8 @@
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        /// <summary>
@@ -68,8 +70,6 @@
            }
        }
        //
        #region  报工平台上料防错单弹窗查找数据
@@ -111,5 +111,99 @@
            return objJsonResult;
        }
        #endregion
        #region 报工平台上料防错一键扫码方法
        [Route("Sc_MaterToSourceBill/get_CheckTypeByBarCode_Json")]
        [HttpGet]
        public object get_CheckTypeByBarCode_Json(string HBarCode,string HSourceID)
        {
            //根据递入的条码前三位,判断条码类型(生产资源、物料条码)
            ds = oCN.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + HBarCode.Substring(0, 3) + "'", "Xt_BarCodeType");
            //无返回数据则为物料条码
            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
                 //1.查询条形码在条码档案表中是否存在
                 //2.匹配用料清单的物料编码是否一致
            }
            else
            {
                string sBarBillName = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSourceName"]);
                string sBarBillType = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0]["BarCodeType"]);
                //判断条码类型为 基础资料条码 或 源单条码
                if (sBarBillType == "基础资料条码")
                {
                    //部门条码
                    if (sBarBillName == "生产资源")
                    {
                        DAL.ClsGy_Source_View dal = new DAL.ClsGy_Source_View();
                        //将递入的条码去掉前三位后转化成整形
                        int ID;
                        if (int.TryParse(HBarCode.Remove(0, 3), out ID))
                        {
                            if (int.Parse(HSourceID)!= ID)
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "生产资源条码与生产订单绑定资源不匹配!";
                                return objJsonResult;
                            }
                            else
                            {
                                if (dal.GetInfoByID(ID))
                                {
                                    objJsonResult.code = "1";
                                    objJsonResult.count = 1;
                                    objJsonResult.Message = "获取资源绑定数据成功!";
                                    objJsonResult.Verify = "资源条码";
                                    objJsonResult.data = dal;
                                    return objJsonResult;
                                }
                                else
                                {
                                    objJsonResult.code = "0";
                                    objJsonResult.count = 0;
                                    objJsonResult.Message = "无效资源条码!";
                                    return objJsonResult;
                                }
                            }
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "错误的部门条码!";
                            return objJsonResult;
                        }
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "无效基础资料条码!";
                        return objJsonResult;
                    }
                }
                //源单条码
                else if (sBarBillType == "源单条码")
                {
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无效条码类型!";
                    return objJsonResult;
                }
            }
            return objJsonResult;
        }
        #endregion
    }
}