Beispiel #1
0
        public string GetStockInfoByMaterialNo(string strBarcodeOrMaterialNo, string strUserJson)
        {
            StockHead_Model stockHeadModel = new StockHead_Model();

            try
            {
                bool bSucc = false;

                if (string.IsNullOrEmpty(strBarcodeOrMaterialNo))
                {
                    stockHeadModel.Status  = "E";
                    stockHeadModel.Message = "请先扫描条码或输入物料编号!";
                    return(JSONUtil.JSONHelper.ObjectToJson <StockHead_Model>(stockHeadModel));
                }

                UserInfo userModel = JSONUtil.JSONHelper.JsonToObject <UserInfo>(strUserJson);
                if (userModel == null || string.IsNullOrEmpty(userModel.UserNo))
                {
                    stockHeadModel.Status  = "E";
                    stockHeadModel.Message = "没有获取用户信息!";
                    return(JSONUtil.JSONHelper.ObjectToJson <StockHead_Model>(stockHeadModel));
                }

                Barcode_Model Barcode_Model        = new Barcode_Model();
                ReceiveGoods.ReceiveGoods_Func RGF = new ReceiveGoods.ReceiveGoods_Func();
                bSucc = RGF.GetBarCodeInfoForQueryStock(strBarcodeOrMaterialNo, ref Barcode_Model);

                if (bSucc == true)
                {
                    stockHeadModel.lstStockInfo = GetStockByMaterialNo(Barcode_Model.MATERIALNO);
                }
                else
                {
                    stockHeadModel.lstStockInfo = GetStockByMaterialNo(strBarcodeOrMaterialNo);
                }

                if (stockHeadModel.lstStockInfo == null || stockHeadModel.lstStockInfo.Count == 0)
                {
                    stockHeadModel.Status  = "E";
                    stockHeadModel.Message = "您扫描的物料或条码没有库存!";
                    return(JSONUtil.JSONHelper.ObjectToJson <StockHead_Model>(stockHeadModel));
                }

                stockHeadModel.Status = "S";
                return(JSONUtil.JSONHelper.ObjectToJson <StockHead_Model>(stockHeadModel));
            }
            catch (Exception ex)
            {
                stockHeadModel.Status  = "E";
                stockHeadModel.Message = "Web异常:" + ex.Message;
                return(JSONUtil.JSONHelper.ObjectToJson <StockHead_Model>(stockHeadModel));
            }
        }
Beispiel #2
0
        public string GetTaskInfo(string strUserJson, string strBarcode)
        {
            TaskHead_Model taskHeadModel = new TaskHead_Model();

            try
            {
                string        strBarcodeJson = string.Empty;
                Barcode_Model barcodeMdl     = new Barcode_Model();

                UserInfo userModel = JSONUtil.JSONHelper.JsonToObject <UserInfo>(strUserJson);

                if (userModel == null || string.IsNullOrEmpty(userModel.UserNo))
                {
                    return(GetFailJson(ref taskHeadModel, "没有用户信息!"));
                }

                if (string.IsNullOrEmpty(strBarcode))
                {
                    //return GetFailJson(ref taskHeadModel, "请扫描或输入条码!");
                    barcodeMdl        = new Barcode_Model();
                    barcodeMdl.Status = "S";
                }
                else
                {
                    ReceiveGoods.ReceiveGoods_Func RGF = new ReceiveGoods.ReceiveGoods_Func();
                    strBarcodeJson = RGF.GetBarCodeInfo(strBarcode);
                    barcodeMdl     = JSONUtil.JSONHelper.JsonToObject <Barcode_Model>(strBarcodeJson);
                }

                if (barcodeMdl.Status == "E")
                {
                    return(GetFailJson(ref taskHeadModel, barcodeMdl.Message));
                }

                Task_DB           TDB     = new Task_DB();
                List <Task_Model> lstTask = new List <Task_Model>();
                lstTask = TDB.GetTaskInfo(userModel, barcodeMdl);

                if (lstTask == null || lstTask.Count <= 0)
                {
                    return(GetFailJson(ref taskHeadModel, "没有上架任务!"));
                }

                taskHeadModel.lstTaskInfo = lstTask;

                taskHeadModel.Status = "S";
                return(JSONUtil.JSONHelper.ObjectToJson <TaskHead_Model>(taskHeadModel));
            }
            catch (Exception ex)
            {
                return(GetFailJson(ref taskHeadModel, ex.Message));
            }
        }