Пример #1
0
        ///// <summary>
        ///// 获取IQC质检数据
        ///// </summary>
        ///// <param name="strMaterialDoc">质检通知书</param>
        ///// <returns></returns>
        //public bool GetQalityForIQCInfo(string strMaterialDoc, ref List<IQCWebservice.CheckInfo> lstCheckInfo, ref string strErrMsg)
        //{
        //    lstCheckInfo = Tool.IQCWebCommon.GetCommon("http://192.168.0.167/IQCInterface/IQCWebService.asmx", 6000).IQCWeb.GetCheckInfoList(strMaterialDoc).ToList();

        //    if (lstCheckInfo == null || lstCheckInfo.Count <= 0)
        //    {
        //        strErrMsg = "没有获取到质检数据!";
        //        return false;
        //    }
        //    return true;
        //}

        /// <summary>
        /// 获取上架任务明细
        /// </summary>
        /// <param name="strTaskNo"></param>
        /// <returns></returns>
        public string GetQulitiedTaskDetailsInfo(string strTaskNo)
        {
            TaskHead_Model taskHeadModel = new TaskHead_Model();

            try
            {
                string     strErrMsg = string.Empty;
                Task_DB    TD        = new Task_DB();
                Task_Model taskModel = new Task_Model();
                taskModel = TD.GetTaskDetailsInfo(strTaskNo);

                if (taskModel.lstTaskDetails == null || taskModel.lstTaskDetails.Count <= 0)
                {
                    return(GetFailJson(ref taskHeadModel, "没有任务明细!"));
                }

                //foreach (var item in taskModel.lstTaskDetails)
                //{
                //    item.ToAreaNo = TD.GetAreaNoByMaterialNo(item.MaterialNo);
                //}
                taskHeadModel.lstTaskInfo = new List <Task_Model>();
                taskHeadModel.lstTaskInfo.Add(taskModel);

                return(GetSuccessJson(ref taskHeadModel));
            }
            catch (Exception ex)
            {
                return(GetFailJson(ref taskHeadModel, ex.Message));
            }
        }
Пример #2
0
        /// <summary>
        /// 验证库位是否存在或可用
        /// </summary>
        /// <param name="strAreaNo"></param>
        /// <param name="strUserJson"></param>
        /// <returns></returns>
        public string CheckArea(string strAreaNo, string strUserJson)
        {
            TaskHead_Model taskHeadModel = new TaskHead_Model();

            try
            {
                int     iSucc = 0;
                Task_DB TD    = new Task_DB();
                iSucc = TD.CheckAreaByNo(strAreaNo);
                if (iSucc == 0)
                {
                    return(GetFailJson(ref taskHeadModel, "该库位已被删除或不存在!库位编码:" + strAreaNo));
                }
                iSucc = TD.CheckAreaIsLock(strAreaNo);
                if (iSucc == 0)
                {
                    return(GetFailJson(ref taskHeadModel, "该库位已被锁定!库位编码:" + strAreaNo));
                }
                return(GetSuccessJson(ref taskHeadModel));
            }
            catch (Exception ex)
            {
                return(GetFailJson(ref taskHeadModel, "Web异常:" + ex));
            }
        }
Пример #3
0
        public string UnLockTaskOperUser(string strInStockInfoJson, string strUserJson)
        {
            TaskHead_Model taskHeadModel = new TaskHead_Model();

            try
            {
                bool bSucc = false;

                string strErrMsg = string.Empty;

                taskHeadModel = JSONUtil.JSONHelper.JsonToObject <TaskHead_Model>(strInStockInfoJson);
                TOOL.WriteLogMethod.WriteLog("方法:UnLockTaskOperUser" + strInStockInfoJson);

                if (taskHeadModel.lstTaskInfo == null || taskHeadModel.lstTaskInfo.Count == 0)
                {
                    return(GetFailJson(ref taskHeadModel, "没有任务表头数据,解锁失败!"));
                }

                Task_Model taskModel = taskHeadModel.lstTaskInfo[0];

                if (taskModel == null || string.IsNullOrEmpty(taskModel.TaskNo))
                {
                    return(GetFailJson(ref taskHeadModel, "没有任务表头数据,解锁失败!"));
                }

                if (taskModel.lstTaskDetails == null || taskModel.lstTaskDetails.Count <= 0)
                {
                    return(GetFailJson(ref taskHeadModel, "没有任务明细数据,解锁失败!"));
                }

                Basic.User.UserInfo userModel = JSONUtil.JSONHelper.JsonToObject <Basic.User.UserInfo>(strUserJson);
                if (userModel == null || string.IsNullOrEmpty(userModel.UserNo))
                {
                    return(GetFailJson(ref taskHeadModel, "没有用户信息,解锁失败!"));
                }

                string strTaskXml = XMLUtil.XmlUtil.Serializer(typeof(Task_Model), taskModel);
                //写入LOGO
                TOOL.WriteLogMethod.WriteLog("方法:UnLockTaskOperUser" + strTaskXml);
                Task_DB TD = new Task_DB();
                bSucc = TD.UnLockTaskOperUser(strTaskXml, userModel, ref strErrMsg);
                if (bSucc == false)
                {
                    return(GetFailJson(ref taskHeadModel, strErrMsg));
                }

                taskHeadModel.Message = "上架数据解锁成功!";
                return(GetSuccessJson(ref taskHeadModel));
            }
            catch (Exception ex)
            {
                return(GetFailJson(ref taskHeadModel, "Web异常:" + ex));
            }
        }
Пример #4
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));
            }
        }
Пример #5
0
        //public string GetUnQulitiedDetailsInfo(string strMaterialDoc)
        //{
        //    TaskHead_Model taskHeadModel = new TaskHead_Model();
        //    try
        //    {
        //        bool bSucc = false;
        //        string strErrMsg = string.Empty;

        //        Task_Model taskModel = new Task_Model();

        //        List<IQCWebservice.CheckInfo> lstCheckInfo = new List<IQCWebservice.CheckInfo>();

        //        bSucc = GetQalityForIQCInfo(strMaterialDoc, ref lstCheckInfo, ref strErrMsg);

        //        if (bSucc == false)
        //        {
        //            return GetFailJson(ref taskHeadModel, strErrMsg);
        //        }

        //        //根据检验通知书获取供应商
        //        Task_DB TDB = new Task_DB();
        //        taskModel = TDB.GetSupplierInfoByMaterialDoc(strMaterialDoc);
        //        if (taskModel == null || string.IsNullOrEmpty(taskModel.SupCusNo))
        //        {
        //            return GetFailJson(ref taskHeadModel, "没有获取到该物料凭证对应的供应商信息!");
        //        }

        //        //转换成task_model
        //        GetUnQuanlityInfo(ref taskModel, lstCheckInfo);

        //        taskHeadModel.lstTaskInfo[0] = new Task_Model();
        //        taskHeadModel.lstTaskInfo[0] = taskModel;

        //        return GetSuccessJson(ref taskHeadModel);

        //    }
        //    catch (Exception ex)
        //    {
        //        return GetFailJson(ref taskHeadModel, ex.Message);
        //    }
        //}

        //private void GetUnQuanlityInfo(ref Task_Model TM, List<IQCWebservice.CheckInfo> lstCheckInfo)
        //{
        //    foreach (var item in lstCheckInfo)
        //    {
        //        TaskDetails_Model TDM = new TaskDetails_Model();
        //        TDM.MaterialNo = item.Sap;
        //        TDM.MaterialDesc = item.SapDetail;
        //        TDM.UnQuanlityQty = item.NotGoodNum;
        //        TDM.UnQuanlityReson = item.Memo;

        //        TM.lstTaskDetails.Add(TDM);
        //    }
        //}


        public string CreateQuanlityReturnVoucher(string strQuanlityJson, string strUserJson)
        {
            TaskHead_Model taskHeadModel = new TaskHead_Model();

            try
            {
                string     strQuanlityXml = string.Empty;
                string     strReturnNo    = string.Empty;
                string     strErrMsg      = string.Empty;
                Task_Model taskModel      = JSONUtil.JSONHelper.JsonToObject <Task_Model>(strQuanlityJson);

                if (taskModel == null || string.IsNullOrEmpty(taskModel.SupCusNo))
                {
                    return(GetFailJson(ref taskHeadModel, "没有对应的供应商信息!"));
                }

                if (taskModel.lstTaskDetails == null || taskModel.lstTaskDetails.Count <= 0)
                {
                    return(GetFailJson(ref taskHeadModel, "没有质检明细数据!"));
                }

                Basic.User.UserInfo userModel = JSONUtil.JSONHelper.JsonToObject <Basic.User.UserInfo>(strUserJson);
                if (userModel == null || string.IsNullOrEmpty(userModel.UserNo))
                {
                    return(GetFailJson(ref taskHeadModel, "用户编号为空!"));
                }

                Task_DB TDB = new Task_DB();
                strQuanlityXml = XMLUtil.XmlUtil.Serializer(typeof(Task_Model), taskModel);
                bool bSucc = TDB.CreateQuanlityReturnVoucher(strQuanlityXml, ref strReturnNo, userModel, ref strErrMsg);
                if (bSucc == false)
                {
                    return(GetFailJson(ref taskHeadModel, strErrMsg));
                }

                taskModel.TaskNo             = strReturnNo;
                taskHeadModel.lstTaskInfo[0] = new Task_Model();
                taskHeadModel.lstTaskInfo[0] = taskModel;

                return(GetSuccessJson(ref taskHeadModel));
            }
            catch (Exception ex)
            {
                return(GetFailJson(ref taskHeadModel, ex.Message));
            }
        }
Пример #6
0
        public string CheckBarCodeIsInStock(string strSerialNo)
        {
            TaskHead_Model taskHeadModel = new TaskHead_Model();

            try
            {
                Task_DB TDB     = new Task_DB();
                int     iResult = TDB.CheckBarCodeIsInStock(strSerialNo);
                if (iResult >= 1)//说明该条码已经上架
                {
                    return(GetFailJson(ref taskHeadModel, "该箱码已经上架,请确认!"));
                }
                return(GetSuccessJson(ref taskHeadModel));
            }
            catch (Exception ex)
            {
                return(GetFailJson(ref taskHeadModel, ex.Message));
            }
        }
Пример #7
0
        /// <summary>
        /// 锁定任务操作人
        /// </summary>
        /// <param name="taskDetailsMdl"></param>
        /// <param name="userMdl"></param>
        /// <param name="strErrMsg"></param>
        /// <returns></returns>
        public string LockTaskOperUser(string strTaskDetailsJson, string strUserJson)
        {
            TaskHead_Model taskHeadModel = new TaskHead_Model();

            try
            {
                int    iLock       = 0;
                string strUserName = string.Empty;

                TaskDetails_Model taskDetailsModel = JSONUtil.JSONHelper.JsonToObject <TaskDetails_Model>(strTaskDetailsJson);

                if (taskDetailsModel == null || (string.IsNullOrEmpty(taskDetailsModel.MaterialNo) && string.IsNullOrEmpty(taskDetailsModel.TMaterialNo)))
                {
                    return(GetFailJson(ref taskHeadModel, "没有物料信息"));
                }

                Basic.User.UserInfo userModel = JSONUtil.JSONHelper.JsonToObject <Basic.User.UserInfo>(strUserJson);
                if (userModel == null || string.IsNullOrEmpty(userModel.UserNo))
                {
                    return(GetFailJson(ref taskHeadModel, "没有用户信息"));
                }

                Task_DB TD = new Task_DB();
                strUserName = TD.QueryUserNameByTaskDetails(taskDetailsModel, userModel);
                if (!string.IsNullOrEmpty(strUserName))
                {
                    return(GetFailJson(ref taskHeadModel, "物料:" + taskDetailsModel.MaterialNo + taskDetailsModel.TMaterialNo + "\r\n" + "被:" + strUserName + "锁定!"));
                }
                iLock = TD.LockTaskOperUser(taskDetailsModel, userModel);

                if (iLock == 0)
                {
                    return(GetFailJson(ref taskHeadModel, "物料:" + taskDetailsModel.MaterialNo + "锁定失败!"));
                }
                return(GetSuccessJson(ref taskHeadModel));
            }
            catch (Exception ex)
            {
                return(GetFailJson(ref taskHeadModel, "Web异常:" + ex));
            }
        }
Пример #8
0
        /// <summary>
        /// 下架
        /// </summary>
        /// <param name="strOutStockInfoJson"></param>
        /// <param name="strAreaNo"></param>
        /// <returns></returns>
        public string OutStock(string strOutStockInfoJson, string strUserJson, string strAreaNo)
        {
            TaskHead_Model taskHeadModel = new TaskHead_Model();

            try
            {
                bool   bSucc     = false;
                string strErrMsg = string.Empty;

                taskHeadModel = JSONUtil.JSONHelper.JsonToObject <TaskHead_Model>(strOutStockInfoJson);
                TOOL.WriteLogMethod.WriteLog("方法:OutStock" + strOutStockInfoJson);
                if (taskHeadModel.lstTaskInfo == null || taskHeadModel.lstTaskInfo.Count == 0)
                {
                    return(GetFailJson(ref taskHeadModel, "没有任务表头数据!"));
                }

                Task_Model taskModel = taskHeadModel.lstTaskInfo[0];

                if (taskModel == null || string.IsNullOrEmpty(taskModel.TaskNo))
                {
                    return(GetFailJson(ref taskHeadModel, "没有任务表头数据!"));
                }

                if (taskModel.lstTaskDetails == null || taskModel.lstTaskDetails.Count <= 0)
                {
                    return(GetFailJson(ref taskHeadModel, "没有下架明细数据!"));
                }

                if (taskModel.lstTaskDetails.Where(t => t.ScanQty > 0).Count() == 0)
                {
                    return(GetFailJson(ref taskHeadModel, "所有物料的下架数量都为零!"));
                }

                if (string.IsNullOrEmpty(strAreaNo))
                {
                    return(GetFailJson(ref taskHeadModel, "没有下架货位!"));
                }

                Basic.User.UserInfo userModel = JSONUtil.JSONHelper.JsonToObject <Basic.User.UserInfo>(strUserJson);
                if (userModel == null || string.IsNullOrEmpty(userModel.UserNo))
                {
                    return(GetFailJson(ref taskHeadModel, "没有用户信息!"));
                }
                taskModel.lstTaskDetails = taskModel.lstTaskDetails.Where(t => t.ScanQty != 0).ToList();

                //下架
                string strTaskXml = XMLUtil.XmlUtil.Serializer(typeof(Task_Model), taskModel);
                //写入LOGO
                TOOL.WriteLogMethod.WriteLog("方法:OutStock---操作人:" + userModel.UserName + strTaskXml);
                Task_DB TD = new Task_DB();
                bSucc = TD.InStock(strAreaNo, strTaskXml, userModel, ref strErrMsg);
                if (bSucc == false)
                {
                    return(GetFailJson(ref taskHeadModel, strErrMsg));
                }

                taskHeadModel.Message = "保存下架数据成功!";
                return(GetSuccessJson(ref taskHeadModel));
            }
            catch (Exception ex)
            {
                return(GetFailJson(ref taskHeadModel, "Web异常:" + ex.Message + ex.StackTrace));
            }
        }
Пример #9
0
        /// <summary>
        /// 上架,生成库存
        /// </summary>
        /// <param name="strInStockInfoJson"></param>
        /// <param name="strAreaNo"></param>
        /// <returns></returns>
        public string InStock(string strInStockInfoJson, string strUserJson, string strAreaNo)
        {
            TaskHead_Model taskHeadModel = new TaskHead_Model();

            try
            {
                bool   bSucc     = false;
                string strErrMsg = string.Empty;

                taskHeadModel = JSONUtil.JSONHelper.JsonToObject <TaskHead_Model>(strInStockInfoJson);
                TOOL.WriteLogMethod.WriteLog("方法:InStock" + strInStockInfoJson);
                if (taskHeadModel.lstTaskInfo == null || taskHeadModel.lstTaskInfo.Count == 0)
                {
                    return(GetFailJson(ref taskHeadModel, "没有任务表头数据!"));
                }

                Task_Model taskModel = taskHeadModel.lstTaskInfo[0];

                if (taskModel == null || string.IsNullOrEmpty(taskModel.TaskNo))
                {
                    return(GetFailJson(ref taskHeadModel, "没有任务表头数据!"));
                }

                if (taskModel.lstTaskDetails == null || taskModel.lstTaskDetails.Count <= 0)
                {
                    return(GetFailJson(ref taskHeadModel, "没有上架明细数据!"));
                }

                //taskModel.lstTaskDetails.ForEach(t => t.ScanQty = t.RemainQty);
                //taskModel.lstTaskDetails[0].lstBarCode = new List<PrintBarcode.Barcode_Model>();
                //PrintBarcode.Barcode_Model BM = new PrintBarcode.Barcode_Model();
                //BM.SERIALNO = "201507140064";
                //taskModel.lstTaskDetails[0].lstBarCode.Add(BM);
                if (taskModel.lstTaskDetails.Where(t => t.ScanQty > 0).Count() == 0)
                {
                    return(GetFailJson(ref taskHeadModel, "所有物料的上架数量都为零!"));
                }

                if (string.IsNullOrEmpty(strAreaNo))
                {
                    return(GetFailJson(ref taskHeadModel, "没有上架货位!"));
                }

                Basic.User.UserInfo userModel = JSONUtil.JSONHelper.JsonToObject <Basic.User.UserInfo>(strUserJson);
                if (userModel == null || string.IsNullOrEmpty(userModel.UserNo))
                {
                    return(GetFailJson(ref taskHeadModel, "没有用户信息!"));
                }
                taskModel.lstTaskDetails = taskModel.lstTaskDetails.Where(t => t.ScanQty != 0).ToList();

                //上架生成库存
                string strTaskXml = XMLUtil.XmlUtil.Serializer(typeof(Task_Model), taskModel);
                //写入LOGO
                TOOL.WriteLogMethod.WriteLog("方法:InStock---操作人:" + userModel.UserName + strTaskXml);
                Task_DB TD = new Task_DB();
                bSucc = TD.InStock(strAreaNo, strTaskXml, userModel, ref strErrMsg);
                if (bSucc == false)
                {
                    return(GetFailJson(ref taskHeadModel, strErrMsg));
                }

                taskHeadModel.Message = "保存上架数据成功!";
                return(GetSuccessJson(ref taskHeadModel));
            }
            catch (Exception ex)
            {
                return(GetFailJson(ref taskHeadModel, "Web异常:" + ex.Message + ex.StackTrace));
            }
        }