Example #1
0
        public string GetOffList(string ErpVoucherno)
        {
            LogNet.LogInfo("发货清单:" + ErpVoucherno);
            BaseMessage_Model <List <OffList> > model = new BaseMessage_Model <List <OffList> >();

            try
            {
                List <OffList>  list = new List <OffList>();
                T_OutBarcode_DB _db  = new T_OutBarcode_DB();
                if (!_db.GetOffList(ErpVoucherno, ref list))
                {
                    model.HeaderStatus = "E";
                    model.Message      = "获取数据失败!";
                    return(JSONHelper.ObjectToJson <BaseMessage_Model <List <OffList> > >(model));
                }
                model.HeaderStatus = "S";
                model.ModelJson    = list;
                return(JSONHelper.ObjectToJson <BaseMessage_Model <List <OffList> > >(model));
            }
            catch (Exception ex)
            {
                model.HeaderStatus = "E";
                model.Message      = ex.Message;
                return(JSONHelper.ObjectToJson <BaseMessage_Model <List <OffList> > >(model));
            }
        }
Example #2
0
        public ActionResult SaveBarcodePro(string data)
        {
            LogNet.LogInfo("外箱打印开始");
            LogNet.LogInfo("外箱打印:" + data);

            var          objT_InStockDetailInfo = JsonConvert.DeserializeObject <View_Product_Model>(data);
            string       err      = "";
            T_Product_DB print_DB = new T_Product_DB();
            DateTime     time1    = DateTime.Now;

            try
            {
                LogNet.LogInfo("外箱打印开始SaveBarcodeForPro前");
                if (print_DB.SaveBarcodeForPro(currentUser, objT_InStockDetailInfo, time1, ref err))
                {
                    LogNet.LogInfo("外箱打印开始SaveBarcodeForPro后");
                    return(Json(new { state = true, obj = time1.ToString("yyyy/MM/dd HH:mm:ss") }, JsonRequestBehavior.AllowGet));
                }
                return(Json(new { state = false, obj = err }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { state = false, obj = ex.ToString() }, JsonRequestBehavior.AllowGet));
            }
        }
Example #3
0
        protected override List <T_QualityDetailInfo> GetModelListByJson(string UserJson, string ModelListJson)
        {
            UserModel userModel = JSONHelper.JsonToObject <UserModel>(UserJson);
            List <T_QualityDetailInfo> modelList = JSONHelper.JsonToObject <List <T_QualityDetailInfo> >(ModelListJson);

            string strUserNo   = string.Empty;
            string strPostUser = string.Empty;

            //if (TOOL.RegexMatch.isExists(userModel.UserNo) == true)
            //{
            //    strUserNo = userModel.UserNo.Substring(0, userModel.UserNo.Length - 1);
            //}
            //else
            //{
            //    strUserNo = userModel.UserNo;
            //}

            //User_DB _db = new User_DB();
            //strPostUser = _db.GetPostAccountByUserNo(strUserNo, modelList[0].StrongHoldCode);

            foreach (var item in modelList)
            {
                item.FromErpWarehouse = item.lstStock.FirstOrDefault().WarehouseNo;
                item.FromErpAreaNo    = item.lstStock.FirstOrDefault().AreaNo;
                item.FromBatchNo      = item.lstStock.FirstOrDefault().BatchNo;
                item.ToErpWarehouse   = userModel.ToSampWareHouseNo;
                item.ToErpAreaNo      = userModel.ToSampAreaNo;
                item.PostUser         = userModel.UserNo;// strPostUser;
            }

            LogNet.LogInfo("UpadteT_QualityUserADF-----" + JSONHelper.ObjectToJson <List <T_QualityDetailInfo> >(modelList));

            return(modelList);
        }
Example #4
0
        public string GetInfoList(string id, string StrongHoldCode)
        {
            LogNet.LogInfo("基础数据:" + id + "S:" + StrongHoldCode);
            T_Material_Batch_Func tfunc = new T_Material_Batch_Func();

            return(tfunc.GetInfoList(id, StrongHoldCode));
        }
Example #5
0
        public bool SaveModelListBySqlToDB(User.UserModel user, ref List <TBase_Model> modelList, ref string strError)
        {
            try
            {
                List <string> lstSql = new List <string>();

                lstSql = this.GetSaveModelListSql(user, modelList);

                if (lstSql == null || lstSql.Count == 0)
                {
                    return(true);
                }

                int i = dbFactory.ExecuteNonQueryList(lstSql, ref strError);

                if (i > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                LogNet.LogInfo("SaveModelListBySqlToDB:" + ex.Message);
                strError = ex.Message;
                return(false);
                //throw new Exception(ex.Message);
            }
        }
Example #6
0
        public string CreateInterfacePost(T_InterfaceInfo model, string VoucherJson)
        {
            JsonModel jsonModel = new JsonModel();

            try
            {
                var assembly = Assembly.LoadFile(@model.Route);

                var type = assembly.GetType(model.ClassName);

                var instance = assembly.CreateInstance(model.ClassName);

                //type.GetProperty("strJson").SetValue(instance, modeJson, null);
                //strError =  type.GetProperty("strErrMsg").GetValue(instance).ToString();

                object[] obj = new object[1];
                obj[0] = VoucherJson;
                var method = type.GetMethod(model.FunctionName);
                return(method.Invoke(instance, obj).ToString());
            }
            catch (Exception ex)
            {
                jsonModel.result = "false";
                jsonModel.ErrMsg = "调用ERP接口异常:" + ex.Message + ex.InnerException;
                LogNet.LogInfo("CreateInterfacePost----" + jsonModel.ErrMsg);
                return(JSONUtil.JSONHelper.ObjectToJson <JsonModel>(jsonModel));
            }
        }
Example #7
0
        public string CreateInterfaceGet(T_InterfaceInfo model, string VoucherJson)
        {
            JsonModel jsonModel = new JsonModel();

            jsonModel.payload                    = new PayLoad();
            jsonModel.payload.std_data           = new Std();
            jsonModel.payload.std_data.execution = new Exe();
            try
            {
                LogNet.LogInfo("VoucherJson:" + VoucherJson);

                var assembly = Assembly.LoadFile(@model.Route);

                var type = assembly.GetType(model.ClassName);

                var instance = assembly.CreateInstance(model.ClassName);

                //type.GetProperty("strJson").SetValue(instance, modeJson, null);
                //strError =  type.GetProperty("strErrMsg").GetValue(instance).ToString();

                object[] obj = new object[1];
                obj[0] = VoucherJson;
                var method = type.GetMethod(model.FunctionName);
                LogNet.LogInfo("---------------------调用ERP接口:" + model.ClassName + model.FunctionName + "参数:" + VoucherJson);
                return(method.Invoke(instance, obj).ToString());
            }
            catch (Exception ex)
            {
                LogNet.LogInfo("CreateInterface:" + ex.InnerException + ex.Message);
                jsonModel.payload.std_data.execution.code        = "1";
                jsonModel.payload.std_data.execution.description = "调用ERP接口异常:" + ex.InnerException + ex.Message;
                return(JSONUtil.JSONHelper.ObjectToJson <JsonModel>(jsonModel));
            }
        }
Example #8
0
        //protected override void OnStart(string[] args)
        public void OnStart()
        {
            StopSync                   = false;
            server                     = WCF.GetWCF();
            syncReceiptTimeFile        = Path.Combine(basePath, syncReceiptFileName);
            syncDeliveryTimeFile       = Path.Combine(basePath, syncDeliveryFileName);
            syncBaseTimeFile           = Path.Combine(basePath, syncBaseFileName);
            syncQualityStatuceTimeFile = Path.Combine(basePath, synQualityStatuceFileName);
            int FirstSyncTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["FirstSyncTime"]);

            //同步时间文件不存在,自动创建
            createSyncTimeFile(syncReceiptTimeFile, FirstSyncTime);
            createSyncTimeFile(syncDeliveryTimeFile, FirstSyncTime);
            createSyncTimeFile(syncBaseTimeFile, FirstSyncTime);
            createSyncTimeFile(syncQualityStatuceTimeFile, FirstSyncTime);
            LogNet.LogInfo("Server Start:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            //DocumentSyncReceipt = new Thread(new ThreadStart(SyncReceipt));
            //DocumentSyncReceipt.Start();
            //DocumentSyncDelivery = new Thread(new ThreadStart(SyncDelivery));
            //DocumentSyncDelivery.Start();
            DocumentSyncBase = new Thread(new ThreadStart(SyncBase));
            DocumentSyncBase.Start();
            //QualitySyncStatus = new Thread(new ThreadStart(QualityStatus));
            //QualitySyncStatus.Start();
        }
Example #9
0
        /// <summary>
        /// 根据选择的任务号ID获取上架任务明细
        /// </summary>
        /// <param name="ModelDetailJson"></param>
        /// <returns></returns>
        public string GetT_InTaskDetailListByHeaderIDADF(string ModelDetailJson)
        {
            T_InTaskDetails_Func tfunc = new T_InTaskDetails_Func();

            LogNet.LogInfo("上架获取明细:" + ModelDetailJson);
            return(tfunc.GetModelListByHeaderIDADF(ModelDetailJson));
        }
Example #10
0
        //三级查询
        public string GetInfoListThree(string id, string StrongHoldCode, string DeparMentNo)
        {
            LogNet.LogInfo("三级查询:" + id + "D:" + DeparMentNo);
            T_Material_Batch_Func tfunc = new T_Material_Batch_Func();

            return(tfunc.GetInfoListThree(id, StrongHoldCode, DeparMentNo));
        }
Example #11
0
        public string SaveT_BarcodeADF(string BarcodeJson)
        {
            LogNet.LogInfo("U9调用BarcodeJson:" + BarcodeJson);
            LogNet.LogInfo("-----------------------------------------------------");
            T_Product_Func tfunc = new T_Product_Func();

            return(tfunc.SaveT_BarcodeADF(BarcodeJson));
        }
Example #12
0
        /// <summary>
        /// 获取入库单据,构造状态1
        /// </summary>
        /// <param name="UserJosn"></param>
        /// <param name="ModelJson"></param>
        /// <returns></returns>
        public string GetT_InStockListADF(string UserJson, string ModelJson)
        {
            LogNet.LogInfo("收货模块UserJson:" + UserJson);
            LogNet.LogInfo("收货模块ModelJson:" + ModelJson);
            LogNet.LogInfo("-----------------------------------------------------");
            T_InStock_Func tfunc = new T_InStock_Func();

            return(tfunc.GetModelListADF(UserJson, ModelJson));
        }
Example #13
0
        //完工提交
        public string SaveT_ProDuctListADF(string UserJson, string ModelJson, string Guid)
        {
            LogNet.LogInfo("完工提交UserJson:" + UserJson);
            LogNet.LogInfo("完工提交ModelJson:" + ModelJson);
            LogNet.LogInfo("-----------------------------------------------------");
            T_Product_Func tfunc = new T_Product_Func();

            return(tfunc.SaveModelListSqlToDBADF(UserJson, ModelJson, Guid));
        }
Example #14
0
        //获取生产订单
        public string GetT_ProDuctListADF(string UserJson, string ModelJson)
        {
            LogNet.LogInfo("获取生产订单UserJson:" + UserJson);
            LogNet.LogInfo("获取生产订单ModelJson:" + ModelJson);
            LogNet.LogInfo("-----------------------------------------------------");
            T_Product_Func tfunc = new T_Product_Func();

            return(tfunc.GetModelList(UserJson, ModelJson));
        }
Example #15
0
        //关联提交
        public string SaveT_ProDuctBarcodeADF(string UserJson, string ModelJson, string PrintIP, string outbarcode)
        {
            LogNet.LogInfo("关联提交UserJson:" + UserJson);
            LogNet.LogInfo("关联提交ModelJson:" + ModelJson);
            LogNet.LogInfo("-----------------------------------------------------");
            T_Product_Func tfunc = new T_Product_Func();

            return(tfunc.SaveT_ProDuctBarcodeADF(UserJson, ModelJson, PrintIP, outbarcode));
        }
Example #16
0
        public string PostZh(string UserJson, string ModelJson, string Guid)
        {
            LogNet.LogInfo("提交转换单UserJson:" + UserJson);
            LogNet.LogInfo("提交转换单ModelJson:" + ModelJson);
            LogNet.LogInfo("提交转换单Guid:" + Guid);
            LogNet.LogInfo("-----------------------------------------------------");
            T_Material_Batch_Func tfunc = new T_Material_Batch_Func();

            return(tfunc.PostZh(UserJson, ModelJson, Guid));
        }
Example #17
0
        public string PostZhMove(string UserJson, string List, string Order, string Type, string Guid)
        {
            LogNet.LogInfo("提交转换单移库UserJson:" + UserJson);
            LogNet.LogInfo("提交转换单移库List:" + List);
            LogNet.LogInfo("提交转换单移库Order:" + Order);
            LogNet.LogInfo("提交转换单移库Type:" + Type);
            LogNet.LogInfo("-----------------------------------------------------");
            T_Material_Batch_Func tfunc = new T_Material_Batch_Func();

            return(tfunc.PostZhMove(UserJson, List, Order, Type, Guid));
        }
Example #18
0
        public string PostCheck(string Json)
        {
            JsonModel jsonModel = new JsonModel();

            jsonModel.payload                    = new PayLoad();
            jsonModel.payload.std_data           = new Std();
            jsonModel.payload.std_data.execution = new Exe();

            try
            {
                List <T_InterfaceInfo> lstModel = GetInterface("8887");
                if (lstModel == null || lstModel.Count == 0)
                {
                    //jsonModel.payload.std_data.execution.code = "1";
                    //jsonModel.payload.std_data.execution.description = "没有配置获取数据二开接口!";
                    jsonModel.result      = "0";
                    jsonModel.resultValue = "没有配置获取数据二开接口!";
                    return(JSONUtil.JSONHelper.ObjectToJson <JsonModel>(jsonModel));
                }

                T_InterfaceInfo model = lstModel.Find(t => t.Function == "3");

                if (model == null)
                {
                    jsonModel.result      = "0";
                    jsonModel.resultValue = "没有配置获取数据二开接口!";
                    return(JSONUtil.JSONHelper.ObjectToJson <JsonModel>(jsonModel));
                }

                JsonModel jsonModel1 = new JsonModel();
                jsonModel1.payload                    = new PayLoad();
                jsonModel1.payload.std_data           = new Std();
                jsonModel1.payload.std_data.execution = new Exe();

                LogNet.LogInfo("VoucherJson:" + Json);
                var      assembly = Assembly.LoadFile(@model.Route);
                var      type     = assembly.GetType(model.ClassName);
                var      instance = assembly.CreateInstance(model.ClassName);
                object[] obj      = new object[1];
                obj[0] = Json;
                var method = type.GetMethod(model.FunctionName);
                LogNet.LogInfo("---------------------调用ERP接口:" + model.ClassName + model.FunctionName + "参数:" + Json);
                return(method.Invoke(instance, obj).ToString());
            }
            catch (Exception ex)
            {
                //jsonModel.payload.std_data.execution.code = "1";
                //jsonModel.payload.std_data.execution.description = ex.Message;
                jsonModel.result      = "0";
                jsonModel.resultValue = ex.Message;
                return(JSONUtil.JSONHelper.ObjectToJson <JsonModel>(jsonModel));
            }
        }
Example #19
0
        /// <summary>
        /// PDA提交JSON转换成List对象
        /// </summary>
        /// <param name="ModelListJson"></param>
        /// <returns></returns>
        protected override List <T_InStockDetailInfo> GetModelListByJson(string UserJson, string ModelListJson)
        {
            int    IsQuality = 0;
            string strUserNo = string.Empty;

            List <T_InStockDetailInfo> modelList = JSONHelper.JsonToObject <List <T_InStockDetailInfo> >(ModelListJson);

            UserModel user = JSONHelper.JsonToObject <UserModel>(UserJson);

            modelList.ForEach(t => t.ReceiveQty = t.ScanQty);
            modelList = modelList.Where(t => t.ReceiveQty > 0).ToList();
            //IsQuality =  GetIsQuality(modelList[0]);
            IsQuality = GetIsQualityByVoucherType(modelList[0]);
            modelList.ForEach(t => t.IsQuality = IsQuality);

            //if (TOOL.RegexMatch.isExists(user.UserNo) == true)
            //{
            //    strUserNo = user.UserNo.Substring(0, user.UserNo.Length - 1);
            //}
            //else
            //{
            //    strUserNo = user.UserNo;
            //}

            ////确定过账人,根据登录账户以及操作的订单据点来确定
            //User_DB _db = new User_DB();
            //string strPostUser = _db.GetPostAccountByUserNo(strUserNo, modelList[0].StrongHoldCode);

            foreach (var item in modelList)
            {
                if (item.lstBarCode != null && item.lstBarCode.Count() > 0)
                {
                    item.SupPrdBatch        = item.lstBarCode.FirstOrDefault().SupPrdBatch;
                    item.SupPrdDate         = item.lstBarCode.FirstOrDefault().SupPrdDate;
                    item.StrSupPrdDate      = item.lstBarCode.FirstOrDefault().SupPrdDate.ToShortDateString();
                    item.BatchNo            = item.lstBarCode.FirstOrDefault().BatchNo; //item.IsSpcBatch=="Y"?item.FromBatchNo: item.lstBarCode.FirstOrDefault().BatchNo;
                    item.ReceiveWareHouseNo = user.ReceiveWareHouseNo;
                    item.ReceiveAreaNo      = string.Empty;
                    item.ReceiveUserNo      = user.UserNo;// strPostUser;
                    item.ToErpWarehouse     = user.ReceiveWareHouseNo;
                    item.ToErpAreaNo        = string.Empty;
                    item.ToBatchNo          = item.BatchNo;
                    item.PostUser           = user.UserNo;
                    item.StrEDate           = item.lstBarCode.FirstOrDefault().EDate.ToString("yyyy/MM/dd");
                }

                //item..PostDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd"));
            }

            LogNet.LogInfo("SaveT_InStockDetailADF---" + JSONHelper.ObjectToJson <List <T_InStockDetailInfo> >(modelList));

            return(modelList);
        }
Example #20
0
        public void OnStop()
        {
            StopSync = true;
            //while (true)
            //{
            //    if (DocumentSyncReceipt != null && DocumentSyncReceipt.ThreadState != System.Threading.ThreadState.Running)
            //    {
            //        DocumentSyncReceipt.Abort();
            //        DocumentSyncReceipt = null;
            //        break;
            //    }

            //    Thread.Sleep(500);
            //}

            //while (true)
            //{
            //    if (DocumentSyncDelivery != null && DocumentSyncDelivery.ThreadState != System.Threading.ThreadState.Running)
            //    {
            //        DocumentSyncDelivery.Abort();
            //        DocumentSyncDelivery = null;
            //        break;
            //    }

            //    Thread.Sleep(500);
            //}

            //while (true)
            //{
            //    if (QualitySyncStatus != null && QualitySyncStatus.ThreadState != System.Threading.ThreadState.Running)
            //    {
            //        QualitySyncStatus.Abort();
            //        QualitySyncStatus = null;
            //        break;
            //    }

            //    Thread.Sleep(500);
            //}
            while (true)
            {
                //if (DocumentSyncBase != null && DocumentSyncBase.ThreadState != System.Threading.ThreadState.Running)
                //{
                DocumentSyncBase.Abort();
                DocumentSyncBase = null;
                break;
                // }

                Thread.Sleep(500);
            }
            LogNet.LogInfo("Server Stop:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
        }
        public bool PostCheckToTrans(List <T_TransportSupDetailInfo> modelList, ref string strError)
        {
            try
            {
                BaseMessage_Model <List <T_TransportSupDetailInfo> > model = new BaseMessage_Model <List <T_TransportSupDetailInfo> >();
                bool   bSucc          = false;
                string strUserNo      = string.Empty;
                string strPostUser    = string.Empty;
                string StrongHoldCode = string.Empty;

                if (modelList[0].ErpVoucherNo.Contains("HH2"))
                {
                    modelList.ForEach(t => t.gtype = "C");
                }
                else
                {
                    modelList.ForEach(t => t.gtype = "A");
                }
                StrongHoldCode = modelList[0].ErpVoucherNo.Substring(0, 3);
                modelList.ForEach(t => t.VoucherType    = 9992);
                modelList.ForEach(t => t.StrongHoldCode = StrongHoldCode);

                T_Interface_Func tfunc         = new T_Interface_Func();
                string           ERPJson       = BILBasic.JSONUtil.JSONHelper.ObjectToJson <List <T_TransportSupDetailInfo> >(modelList);
                string           interfaceJson = tfunc.PostModelListToInterface(ERPJson);

                model = BILBasic.JSONUtil.JSONHelper.JsonToObject <BaseMessage_Model <List <T_TransportSupDetailInfo> > >(interfaceJson);

                LogNet.LogInfo("ERPJsonAfter:" + BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <T_TransportSupDetailInfo> > >(model));

                //过账失败直接返回
                if (model.HeaderStatus == "E" && !string.IsNullOrEmpty(model.Message))
                {
                    strError = "回传T100费用失败!" + model.Message;
                    bSucc    = false;
                }
                else if (model.HeaderStatus == "S" && !string.IsNullOrEmpty(model.MaterialDoc)) //过账成功,并且生成了凭证要记录数据库
                {
                    strError = "回传T100费用成功!凭证号:" + model.MaterialDoc;
                    bSucc    = true;
                }

                return(bSucc);
            }
            catch (Exception ex)
            {
                strError = ex.Message;
                return(false);
            }
        }
Example #22
0
        protected override List <T_OutStockTaskDetailsInfo> GetModelListByJson(string UserJson, string ModelListJson)
        {
            UserModel userModel = JSONHelper.JsonToObject <UserModel>(UserJson);
            List <T_OutStockTaskDetailsInfo> NewModelList = new List <T_OutStockTaskDetailsInfo>();
            List <T_OutStockTaskDetailsInfo> modelList    = new List <T_OutStockTaskDetailsInfo>();

            modelList = JSONHelper.JsonToObject <List <T_OutStockTaskDetailsInfo> >(ModelListJson);
            modelList = modelList.Where(t => t.ScanQty > 0).ToList();
            modelList.ForEach(t => t.VoucherType = 9996);
            LogNet.LogInfo("SaveT_OutStockTaskDetailADF---" + JSONHelper.ObjectToJson <List <T_OutStockTaskDetailsInfo> >(modelList));
            //modelList.ForEach(t => t.PostUser = userModel.UserNo);
            //modelList.ForEach(t => t.ToErpAreaNo = userModel.PickAreaNo);
            //modelList.ForEach(t => t.ToErpWarehouse = userModel.PickWareHouseNo);
            return(modelList);
        }
Example #23
0
        /// <summary>
        ///质检同步
        /// </summary>
        void QualityStatus()
        {
            int SyncQualityStatusTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["QualitySyncStatus"]) * 1000;

            while (!StopSync)
            {
                try
                {
                    string lastQualityStatusTime = string.Empty; //初始时间
                    if (File.Exists(syncBaseTimeFile))
                    {
                        using (StreamReader sr = new StreamReader(syncQualityStatuceTimeFile))
                        {
                            lastQualityStatusTime = sr.ReadLine(); //最后执行日期
                            sr.Close();
                        }
                    }
                    LogNet.LogInfo("同步质检数据开始:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    string errMsg = "";
                    List <T_QualityInfo> modelList = new List <T_QualityInfo>();
                    string strError = String.Empty;
                    bool   result   = server.GetT_AllQualityList(ref modelList, ref strError);
                    if (result && modelList.Count != 0)
                    {
                        foreach (T_QualityInfo model in modelList)
                        {
                            result  = server.UpdateStockByQuality(model.ErpVoucherNo, ref errMsg);
                            errMsg += result ? model.ErpVoucherNo + "\r\n" : "|";
                        }
                    }
                    LogNet.LogInfo("同步质检数据结束:" + result + "\r\n" + strError + "\r\n" + errMsg + "\r\n同步时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    if (result)
                    {
                        using (StreamWriter sw = new StreamWriter(syncBaseTimeFile))
                        {
                            sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd"));
                            sw.Close();
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogNet.LogInfo("同步质检数据错误:" + ex.Message + "\t同步时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                }
                Thread.Sleep(SyncQualityStatusTime);
            }
        }
Example #24
0
        public bool PostCloseOutStockVoucherNo(List <T_OutStockInfo> modelList, ref string strError)
        {
            try
            {
                BaseMessage_Model <List <T_OutStockInfo> > model = new BaseMessage_Model <List <T_OutStockInfo> >();
                bool bSucc = false;
                //string strUserNo = string.Empty;
                //string strPostUser = string.Empty;
                //string StrongHoldCode = string.Empty;

                //StrongHoldCode = modelList[0].ErpVoucherNo.Substring(0, 3);
                //modelList.ForEach(t => t.VoucherType = 50);
                //modelList.ForEach(t => t.WmsStatus = "E");
                //modelList.ForEach(t => t.StrongHoldCode = StrongHoldCode);

                T_Interface_Func tfunc   = new T_Interface_Func();
                string           ERPJson = BILBasic.JSONUtil.JSONHelper.ObjectToJson <List <T_OutStockInfo> >(modelList);
                LogNet.LogInfo("closeJSON:" + ERPJson);
                string interfaceJson = tfunc.PostModelListToInterface(ERPJson);

                model = BILBasic.JSONUtil.JSONHelper.JsonToObject <BaseMessage_Model <List <T_OutStockInfo> > >(interfaceJson);

                LogNet.LogInfo("ERPJsonAfter:" + BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <T_OutStockInfo> > >(model));

                //过账失败直接返回
                if (model.HeaderStatus == "E" && !string.IsNullOrEmpty(model.Message))
                {
                    strError = "回传T100关闭状态失败!" + model.Message;
                    bSucc    = false;
                }
                else if (model.HeaderStatus == "S" && !string.IsNullOrEmpty(model.MaterialDoc)) //过账成功,并且生成了凭证要记录数据库
                {
                    strError = "回传T100关闭状态成功!凭证号:" + model.MaterialDoc;
                    bSucc    = true;
                }

                return(bSucc);
            }
            catch (Exception ex)
            {
                strError = ex.Message;
                return(false);
            }
        }
        public string DelStockForU9(string ErpVoucherNo, string ErpVoucherNoIn, string Guid)
        {
            LogNet.LogInfo("ErpVoucherNo:" + ErpVoucherNo + ",ErpVoucherNoIn:" + ErpVoucherNoIn + ",Guid:" + Guid);
            BaseMessage_Model <string> messageModel = new BaseMessage_Model <string>();

            try
            {
                string strError = string.Empty;
                if (string.IsNullOrEmpty(ErpVoucherNo) || string.IsNullOrEmpty(Guid) || string.IsNullOrEmpty(ErpVoucherNoIn))
                {
                    messageModel.HeaderStatus = "E";
                    messageModel.Message      = "成品入库单,调入单和Guid不能为空!";
                    return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <string> >(messageModel));
                }
                if (!CheckGuid(Guid, ref strError))
                {
                    messageModel.HeaderStatus = "E";
                    messageModel.Message      = "GUID已经存在,不能重复提交-" + strError;
                    return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <string> >(messageModel));
                }
                T_OutTaskDetails_DB _db = new T_OutTaskDetails_DB();
                if (_db.DelStockForU9(ErpVoucherNo, ErpVoucherNoIn, ref strError) == false)
                {
                    messageModel.HeaderStatus = "E";
                    messageModel.Message      = strError;
                    return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <string> >(messageModel));
                }
                else
                {
                    messageModel.HeaderStatus = "S";
                    messageModel.Message      = "操作成功!";
                    return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <string> >(messageModel));
                }
            }
            catch (Exception ex)
            {
                messageModel.HeaderStatus = "E";
                messageModel.Message      = ex.Message;
                return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <string> >(messageModel));
            }
        }
Example #26
0
        /// <summary>
        /// 发货数据同步
        /// </summary>
        void SyncDelivery()
        {
            int SyncDeliverytTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SyncDeliverytTime"]) * 1000;

            while (!StopSync)
            {
                try
                {
                    string lastSyncDeliveryTime = string.Empty; //初始时间
                    if (File.Exists(syncDeliveryTimeFile))
                    {
                        using (StreamReader sr = new StreamReader(syncDeliveryTimeFile))
                        {
                            lastSyncDeliveryTime = sr.ReadLine(); //最后执行日期
                            sr.Close();
                        }
                    }
                    LogNet.LogInfo("同步发货数据开始:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    string errMsg = "";
                    bool   result = server.DocumentSyncDelivery("", String.Empty, ref errMsg, 22, "ERP", -1, null);
                    LogNet.LogInfo("同步发货数据结束:" + result + "\r\n" + errMsg + "\r\n同步时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    if (result)
                    {
                        using (StreamWriter sw = new StreamWriter(syncDeliveryTimeFile))
                        {
                            sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                            sw.Close();
                        }
                    }
                    Thread.Sleep(SyncDeliverytTime);
                }
                catch (Exception ex)
                {
                    LogNet.LogInfo("同步发货数据错误:" + ex.Message + "\t同步时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    Thread.Sleep(SyncDeliverytTime);
                }
            }
        }
Example #27
0
        //public override List<T_OutStockTaskDetailsInfo> GetModelListByHeaderID(int headerID)
        //{
        //    try
        //    {
        //        string strError = string.Empty;

        //        List<T_StockInfo> lstStock = new List<T_StockInfo>();
        //        List<T_OutStockTaskDetailsInfo> list = base.GetModelListByHeaderID(headerID);

        //        if (list == null || list.Count == 0)
        //        {
        //            return null;
        //        }

        //        if (GetPickRuleAreaNo(list, ref lstStock, ref strError) == false)
        //        {
        //            throw new Exception(strError);
        //        }

        //        //if (lstStock == null || lstStock.Count == 0)
        //        //{
        //        //    throw new Exception("获取物料对应拣货库位为空!");
        //        //}

        //       return  CreateNewListByPickRuleAreaNo(list, lstStock);

        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception(ex.Message);
        //    }


        //}


        public bool GetPickRuleAreaNo(List <T_OutStockTaskDetailsInfo> modelList, ref List <T_StockInfo> stockList, ref string strError)
        {
            try
            {
                int     iResult = 0;
                DataSet ds;

                string strOutStockTaskXml = XmlUtil.Serializer(typeof(List <T_OutStockTaskDetailsInfo>), modelList);
                LogNet.LogInfo("GetPickRuleAreaNo:" + strOutStockTaskXml);
                OracleParameter[] cmdParms = new OracleParameter[]
                {
                    new OracleParameter("strOutStockTaskXml", OracleDbType.NClob),
                    new OracleParameter("PickAreaCur", OracleDbType.RefCursor, ParameterDirection.Output),
                    new OracleParameter("bResult", OracleDbType.Int32, ParameterDirection.Output),
                    new OracleParameter("ErrString", OracleDbType.NVarchar2, 200, strError, ParameterDirection.Output)
                };

                cmdParms[0].Value = strOutStockTaskXml;

                cmdParms[1].Value = ParameterDirection.Output;
                cmdParms[2].Value = ParameterDirection.Output;
                cmdParms[3].Value = ParameterDirection.Output;

                ds = dbFactory.ExecuteDataSetForCursor(ref iResult, ref strError, dbFactory.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "p_getpickarea", cmdParms);

                if (iResult == 1)
                {
                    stockList = TOOL.DataTableToList.DataSetToList <T_StockInfo>(ds.Tables[0]);
                    strError  = string.Empty;
                }

                return(iResult == 1 ? true : false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #28
0
        public string SaveT_BarcodeADF(string BarcodeJson)
        {
            LogNet.LogInfo("U9生成条码类BarcodeJson:" + BarcodeJson);
            BaseMessage_Model <string> messageModel = new BaseMessage_Model <string>();

            try
            {
                if (string.IsNullOrEmpty(BarcodeJson))
                {
                    messageModel.HeaderStatus = "E";
                    messageModel.Message      = "传入参数不能为空!";
                    return(JsonConvert.SerializeObject(messageModel));
                }

                List <Barcode_Model> BarcodeModel = JSONHelper.JsonToObject <List <Barcode_Model> >(BarcodeJson);
                T_Product_DB         ProductDB    = new T_Product_DB();
                string strMsg = "";
                if (ProductDB.SaveBarcode(BarcodeModel, ref strMsg))
                {
                    messageModel.HeaderStatus = "S";
                    messageModel.Message      = "打印成功";
                    return(JsonConvert.SerializeObject(messageModel));
                }
                else
                {
                    messageModel.HeaderStatus = "E";
                    messageModel.Message      = "数据插入失败!" + strMsg;
                    return(JsonConvert.SerializeObject(messageModel));
                }
            }
            catch (Exception ex)
            {
                messageModel.HeaderStatus = "E";
                messageModel.Message      = ex.ToString();
                return(JsonConvert.SerializeObject(messageModel));
            }
        }
Example #29
0
        public string SaveModelListSqlToDBADF(User.UserModel user, List <TBase_Model> modelList)
        {
            BaseMessage_Model <List <TBase_Model> > model = new BaseMessage_Model <List <TBase_Model> >();

            try
            {
                bool bSucc = false;

                string strError = "";


                if (user == null)
                {
                    model.HeaderStatus = "E";
                    model.Message      = "传入用户信息为空!";
                    JsonConvert.SerializeObject(model);
                }


                if (CheckModelBeforeSave(modelList, ref strError) == false)
                {
                    model.HeaderStatus = "E";
                    model.Message      = strError;
                    JsonConvert.SerializeObject(model);
                }

                T_Interface_Func tfunc   = new T_Interface_Func();
                string           ERPJson = GetModelListByJsonToERP(user, modelList);//JSONUtil.JSONHelper.ObjectToJson<List<TBase_Model>>(modelList);

                LogNet.LogInfo("ERPJsonBefore:" + ERPJson);
                string interfaceJson = tfunc.PostModelListToInterface(ERPJson);
                LogNet.LogInfo("YMH00000000ERP:" + interfaceJson);

                model = JSONUtil.JSONHelper.JsonToObject <BaseMessage_Model <List <TBase_Model> > >(interfaceJson);

                LogNet.LogInfo("ERPJsonAfter:" + JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <TBase_Model> > >(model));

                //过账失败直接返回
                if (model.HeaderStatus == "E" && !string.IsNullOrEmpty(model.Message))
                {
                    return(interfaceJson);
                }
                else if (model.HeaderStatus == "S" && !string.IsNullOrEmpty(model.MaterialDoc)) //过账成功,并且生成了凭证要记录数据库
                {
                    modelList.ForEach(t => t.MaterialDoc = model.MaterialDoc);
                }

                //LogNet.LogInfo("ERPJson:" + JSONUtil.JSONHelper.ObjectToJson<List<TBase_Model>>(modelList));

                bSucc = db.SaveModelListBySqlToDB(user, ref modelList, ref strError);

                if (bSucc == false)
                {
                    model.HeaderStatus = "E";
                    model.Message      = strError;
                }
                else
                {
                    model.HeaderStatus = "S";
                    model.TaskNo       = modelList[0].TaskNo;
                    model.Message      = GetSuccessMessage(model.MaterialDoc, modelList[0].TaskNo);
                }

                return(JsonConvert.SerializeObject(model));
            }
            catch (Exception ex)
            {
                model.HeaderStatus = "E";
                model.Message      = "保存" + GetModelChineseName() + "失败!" + ex.Message + ex.TargetSite;

                return(JsonConvert.SerializeObject(model));
            }
        }
Example #30
0
        public string UserLoginADF(string UserJson)
        {
            BaseMessage_Model <UserInfo> messageModel = new BaseMessage_Model <UserInfo>();

            try
            {
                UserInfo model;
                User_DB  _db = new User_DB();
                DateTime CurrentTime;

                LogNet.LogInfo("UserLoginADF---" + UserJson);
                UserInfo user = BILBasic.JSONUtil.JSONHelper.JsonToObject <UserInfo>(UserJson);
                //UserInfo user = JsonConvert.DeserializeObject<UserInfo>(UserJson);

                model = _db.GetModelBySql(user);

                if (model == null)
                {
                    int iSucc = _db.GetScalarBySql(user);
                    if (iSucc <= 0)
                    {
                        messageModel.Message      = "该用户不存在,请检查大小写是否输入正确!";
                        messageModel.HeaderStatus = "E";
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                    }
                    else
                    {
                        messageModel.Message      = "密码输入错误,忘记密码请联系管理员重置!";
                        messageModel.HeaderStatus = "E";
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                    }
                }

                CurrentTime = model.CurrentTime;

                if (user.WarehouseID != -100)
                {
                    if (!model.WarehouseCode.Contains(user.WarehouseID.ToString()))
                    {
                        messageModel.Message      = "登录账户与所选仓库不一致!";
                        messageModel.HeaderStatus = "E";
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                    }
                }


                if (model.UserStatus == 2)
                {
                    messageModel.Message      = string.Format("用户【{0}】已停用", model.UserName);
                    messageModel.HeaderStatus = "E";
                    return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                }

                if (model.IsDel == 2)
                {
                    messageModel.Message      = string.Format("用户【{0}】已删除", model.UserName);
                    messageModel.HeaderStatus = "E";
                    return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                }

                model.WarehouseID = user.WarehouseID;
                user = model;

                T_UserGroup_Func       ugf      = new T_UserGroup_Func();
                List <T_UserGroupInfo> lstGroup = new List <T_UserGroupInfo>();

                if (ugf.GetModelListBySql(user, ref lstGroup))
                {
                    user.lstUserGroup = lstGroup;
                }

                //暂时屏蔽
                T_MENU_Func       tmfun   = new T_MENU_Func();
                List <T_MenuInfo> lstMenu = new List <T_MenuInfo>();

                if (tmfun.GetModelListBySql(user, ref lstMenu, false))
                {
                    user.lstMenu = lstMenu.Where(t => t.MenuType == 4).ToList();
                }

                //根据用户配置的仓库ID,获取对应的收货,发货库位
                T_Area_Func       tafun   = new T_Area_Func();
                List <T_AreaInfo> lstArea = new List <T_AreaInfo>();

                if (tafun.GetModelListBySql(user.WarehouseID, ref lstArea))
                {
                    T_AreaInfo areaInfo = new T_AreaInfo();
                    //查找收货待检库位
                    areaInfo = lstArea.Find(t => t.AreaType == 2);
                    if (areaInfo != null)
                    {
                        user.ReceiveHouseID       = areaInfo.HouseID;
                        user.ReceiveAreaID        = areaInfo.ID;
                        user.ReceiveAreaNo        = areaInfo.AreaNo;
                        user.ReceiveWareHouseNo   = areaInfo.WarehouseNo;
                        user.ReceiveHouseNo       = areaInfo.HouseNo;
                        user.ReceiveWareHouseName = areaInfo.WarehouseName;
                        user.QuanUserNo           = areaInfo.QuanUserNo;
                        user.QuanUserName         = areaInfo.QuanUserName;
                        //user.lstQuanUser = _db.GetQuanUser(user.QuanUserNo);
                    }

                    //查找拣货临时库位
                    areaInfo = lstArea.Find(t => t.AreaType == 3);
                    if (areaInfo != null)
                    {
                        user.PickHouseID       = areaInfo.HouseID;
                        user.PickAreaID        = areaInfo.ID;
                        user.PickWareHouseID   = areaInfo.WarehouseID;
                        user.PickAreaNo        = areaInfo.AreaNo;
                        user.PickWareHouseNo   = areaInfo.WarehouseNo;
                        user.PickHouseNo       = areaInfo.HouseNo;
                        user.PickWareHouseName = areaInfo.WarehouseName;
                    }

                    areaInfo = lstArea.Find(t => t.AreaType == 4);
                    if (areaInfo != null)
                    {
                        user.ToSampWareHouseNo = areaInfo.WarehouseNo;
                        user.ToSampAreaNo      = areaInfo.AreaNo;
                    }
                }

                //T_WareHouse_Func twfun = new T_WareHouse_Func();
                //List<T_WareHouseInfo> lstWarehouse = new List<T_WareHouseInfo>();
                //if (twfun.GetModelListBySql(user, ref lstWarehouse))
                //{
                //    user.lstWarehouse = lstWarehouse;
                //}

                messageModel.Message      = "登录成功!";
                messageModel.HeaderStatus = "S";
                messageModel.ModelJson    = user;
                return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));


                //return JsonConvert.SerializeObject(messageModel);
            }
            catch (Exception ex)
            {
                messageModel.Message      = ex.Message;
                messageModel.HeaderStatus = "E";
                return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
            }
        }