Пример #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>
        /// <returns></returns>
        public List <Task_Model> GetTaskInfo(UserInfo userModel, Barcode_Model barcodeMdl)
        {
            try
            {
                List <Task_Model> lstTask = new List <Task_Model>();

                string strSql = string.Empty;

                if (string.IsNullOrEmpty(barcodeMdl.SERIALNO))
                {
                    strSql = string.Format("select * from V_GETTASKINFO where F_USERINWAREHOUSE(warehouse_id,'{0}')>0", userModel.WarehouseCode);
                }
                else
                {
                    if (barcodeMdl.VOUCHERTYPE == "50" || barcodeMdl.VOUCHERTYPE == "60")
                    {
                        strSql = string.Format("select * from V_GETTASKINFO a where F_USERINWAREHOUSE(a.warehouse_id,'{0}')>0 and taskno = '{1}'", userModel.WarehouseCode, barcodeMdl.DELIVERYNO);
                    }
                    else
                    {
                        //strSql = string.Format("select * from V_GETTASKINFO a where F_USERINWAREHOUSE(a.warehouse_id,'{0}')>0 and deliveryno = '{1}'", userModel.WarehouseCode, barcodeMdl.DELIVERYNO);
                        strSql = string.Format(@"SELECT ID,TaskNo,'生产订单' VoucherTypeName
  , IsShelvePost, IsQuality, CreateDateTime, DeliveryNo MaterialDoc
  , VoucherType, DeliveryNo, (select top 1 username from T_USER where T_USER.userno =[T_TASK].receiveuserno and isdel = 1) ReceiveUserName
        FROM[T_TASK] where deliveryno = '{0}'", barcodeMdl.DELIVERYNO);
                    }
                }


                using (SqlDataReader dr = OperationSql.ExecuteReader(System.Data.CommandType.Text, strSql))
                {
                    while (dr.Read())
                    {
                        Task_Model TM = new Task_Model();
                        TM.ID              = Convert.ToInt32(dr["ID"]);
                        TM.TaskNo          = dr["taskno"].ToDBString();
                        TM.ReceiveUserName = dr["receiveusername"].ToDBString();
                        TM.VoucherTypeName = dr["vouchertypename"].ToDBString();
                        TM.IsShelvePost    = dr["isshelvepost"].ToInt32();
                        TM.IsQuality       = dr["IsQuality"].ToInt32();
                        TM.CreateDateTime  = dr["CreateDateTime"].ToDateTime();
                        TM.MaterialDoc     = dr["materialdoc"].ToDBString();
                        TM.VoucherType     = dr["VoucherType"].ToInt32();
                        TM.DeliveryNo      = dr["deliveryno"].ToDBString();
                        lstTask.Add(TM);
                    }
                }
                return(lstTask);
            }
            catch (Exception ex)
            {
                throw 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 Task_Model GetTaskDetailsInfo(string strTaskNo)
        {
            try
            {
                Task_Model TM = new Task_Model();
                TM.lstTaskDetails = new List <TaskDetails_Model>();

                string strSql = string.Format("select * from V_GETTASKDETAILSINFO where taskno = '{0}'", strTaskNo);

                using (SqlDataReader dr = OperationSql.ExecuteReader(System.Data.CommandType.Text, strSql))
                {
                    while (dr.Read())
                    {
                        TM.ID           = dr["task_id"].ToInt32();
                        TM.TaskNo       = dr["taskno"].ToDBString();
                        TM.TaskStatus   = dr["taskstatus"].ToInt32();
                        TM.IsShelvePost = dr["isshelvepost"].ToInt32();
                        TM.IsQuality    = dr["isquality"].ToInt32();
                        TM.VoucherType  = dr["VoucherType"].ToInt32();
                        TM.Plant        = dr["plant"].ToDBString();
                        TM.DeliveryNo   = dr["deliveryno"].ToDBString();

                        TaskDetails_Model TDM = new TaskDetails_Model();
                        TDM.ID              = dr["id"].ToInt32();
                        TDM.MaterialNo      = dr["materialno"].ToDBString();
                        TDM.MaterialDesc    = dr["materialdesc"].ToDBString();
                        TDM.MaterialStd     = dr["MaterialStd"].ToDBString();
                        TDM.TaskQty         = dr["taskqty"].ToDecimal();
                        TDM.QuanlityQty     = dr["qualityqty"].ToDecimal();
                        TDM.RemainQty       = dr["remainqty"].ToDecimal();
                        TDM.ShelveQty       = dr["shelveqty"].ToDecimal();
                        TDM.RowNo           = dr["RowNo"].ToDBString();
                        TDM.VoucherNo       = dr["VoucherNo"].ToDBString();
                        TDM.PackCount       = dr["PackCount"].ToDecimal();
                        TDM.ShelvePackCount = dr["ShelvePackCount"].ToDecimal();
                        TDM.RemainPackCount = dr["RemainPackCount"].ToDecimal();
                        TM.lstTaskDetails.Add(TDM);
                    }
                }
                strSql         = string.Format(@"SELECT A.warehouseno FROM T_WAREHOUSE A JOIN T_TASKWAREHOUSE B ON A.id=B.warehouse_id JOIN T_TASK C ON B.task_id=C.id
WHERE C.taskno = '{0}'", strTaskNo);
                TM.WareHouseNo = OperationSql.ExecuteScalar(CommandType.Text, strSql, null).ToString();
                return(TM);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #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 Task_Model GetSupplierInfoByMaterialDoc(string strMaterialDoc)
 {
     try
     {
         string     strSql = string.Format("select * from V_GETSUPPLIERINFOBYMATERIALDOC where a.materialdoc = {0}", strMaterialDoc);
         Task_Model TM     = new Task_Model();
         using (SqlDataReader dr = OperationSql.ExecuteReader(System.Data.CommandType.Text, strSql))
         {
             if (dr.Read())
             {
                 TM.SupCusNo   = dr["supplierno"].ToString();
                 TM.SupCusName = dr["suppliername"].ToString();
                 TM.DeliveryNo = dr["deliveryno"].ToString();
             }
         }
         return(TM);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #7
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));
            }
        }
Пример #8
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));
            }
        }