コード例 #1
0
        public string PostInventorySyn()
        {
            NetLog.Write("MES库存同步SAP(初始化)" + "   ");

            var oldBatchs = GetFDIInventorySynBacths("");
            List <FDIInventorySynBacth> Batchs = new List <FDIInventorySynBacth>();

            var oldMains = GetFDIInventorySyns("");
            List <FDIInventorySyn> Mains = new List <FDIInventorySyn>();

            foreach (var m in oldMains)
            {
                FDIInventorySyn main = new FDIInventorySyn();
                main.CopyDataItem(m);

                main.Batchs = new List <FDIInventorySynBacth>();
                foreach (var d in oldBatchs.Where(c => c.ItemCode == m.ItemCode))
                {
                    FDIInventorySynBacth detial = new FDIInventorySynBacth();
                    detial.CopyDataItem(d);

                    main.Batchs.Add(detial);
                }


                Mains.Add(main);
            }

            string jsonText = SafeConverter.JsonSerializeObject(Mains);

            return(jsonText);
        }
コード例 #2
0
        public string GetMaterialInfo(string jsMaterialInfo)
        {
            NetLog.Write("GetRawMaterialInfo" + "   " + jsMaterialInfo);

            List <FDIGetMaterialInfo> mains = new List <FDIGetMaterialInfo>();

            try
            {
                mains = SafeConverter.JsonDeserializeObject <List <FDIGetMaterialInfo> >(jsMaterialInfo);


                foreach (var main in mains)
                {
                    var check = GetFDIGetMaterialInfos($"ItemCode = '{main.ItemCode}'");
                    foreach (var c in check)
                    {
                        DelFDIGetMaterialInfo(c.PKNO);
                    }
                    main.PKNO = CBaseData.NewGuid();
                    AddFDIGetMaterialInfo(main);
                }
            }
            catch (Exception ex)
            {
                NetLog.Error("GetRawMaterialInfo   error", ex);
                return("error: " + ex.Message);
            }

            return("OK");
        }
コード例 #3
0
        protected override void OnExit(ExitEventArgs e)
        {
            AppExit(e.ApplicationExitCode);

#if !DEBUG
            NetLog.Write("============系统 " + ((e.ApplicationExitCode == 0) ? "正常" : "异常(" + e.ApplicationExitCode + ")") + " 退出=========");
#endif
        }
コード例 #4
0
        public string PostRawMaterial()
        {
            NetLog.Write("MES回传SAP原材料入库" + "   ");

            var oldBatchs = GetFDIPostRawMaterialBatchs("");
            List <FDIPostRawMaterialBatch> Batchs = new List <FDIPostRawMaterialBatch>();

            var oldDetails = GetFDIPostRawMaterialDetails("");

            var oldMains = GetFDIPostRawMaterials("");
            List <FDIPostRawMaterial> Mains = new List <FDIPostRawMaterial>();

            foreach (var m in oldMains)
            {
                FDIPostRawMaterial main = new FDIPostRawMaterial();
                main.CopyDataItem(m);

                main.Details = new List <FDIPostRawMaterialDetail>();
                foreach (var d in oldDetails.Where(c => c.DocEntry == m.DocEntry))
                {
                    FDIPostRawMaterialDetail detial = new FDIPostRawMaterialDetail();
                    detial.CopyDataItem(d);

                    detial.Batchs = new List <FDIPostRawMaterialBatch>();
                    foreach (var b in oldBatchs.Where(c => c.DocEntry == m.DocEntry && c.LineNum == d.LineId))
                    {
                        FDIPostRawMaterialBatch batch = new FDIPostRawMaterialBatch();
                        batch.CopyDataItem(b);

                        detial.Batchs.Add(batch);
                    }

                    main.Details.Add(detial);
                }


                Mains.Add(main);
            }

            string jsonText = SafeConverter.JsonSerializeObject(Mains);

            return(jsonText);
        }
コード例 #5
0
        public string PostDNOrder()
        {
            NetLog.Write("MES回传SAP销售发货单" + "   ");

            var oldBatchs = GetFDIPostSaleOrderBatchs("");
            List <FDIPostSaleOrderBatch> Batchs = new List <FDIPostSaleOrderBatch>();

            var oldDetails = GetFDIPostSaleOrderDetails("");

            var oldMains = GetFDIPostSaleOrders("Flag_In = 0");
            List <FDIPostSaleOrder> Mains = new List <FDIPostSaleOrder>();

            foreach (var m in oldMains)
            {
                FDIPostSaleOrder main = new FDIPostSaleOrder();
                main.CopyDataItem(m);

                main.Details = new List <FDIPostSaleOrderDetail>();
                foreach (var d in oldDetails.Where(c => c.DocEntry == m.DocEntry))
                {
                    FDIPostSaleOrderDetail detail = new FDIPostSaleOrderDetail();
                    detail.CopyDataItem(d);

                    main.Details.Add(detail);

                    detail.Batchs = new List <FDIPostSaleOrderBatch>();

                    foreach (var b in oldBatchs.Where(c => c.DocEntry == m.DocEntry && c.LineNum == d.LineId))
                    {
                        FDIPostSaleOrderBatch batch = new FDIPostSaleOrderBatch();
                        batch.CopyDataItem(b);

                        detail.Batchs.Add(batch);
                    }
                }

                Mains.Add(main);
            }

            string jsonText = SafeConverter.JsonSerializeObject(Mains);

            return(jsonText);
        }
コード例 #6
0
        public string GetRawMaterial(string jsMaterialMain, string jsMaterialDetail)
        {
            NetLog.Write("GetRawMaterial" + "   " + jsMaterialMain);
            NetLog.Write("GetRawMaterial" + "   " + jsMaterialDetail);
            List <FDIGetRawMaterial>       mains   = new List <FDIGetRawMaterial>();
            List <FDIGetRawMaterialDetail> detials = new List <FDIGetRawMaterialDetail>();

            try
            {
                mains   = SafeConverter.JsonDeserializeObject <List <FDIGetRawMaterial> >(jsMaterialMain);
                detials = SafeConverter.JsonDeserializeObject <List <FDIGetRawMaterialDetail> >(jsMaterialDetail);

                foreach (var main in mains)
                {
                    var check = GetFDIGetRawMaterials($"DocEntry = '{main.DocEntry}'");
                    foreach (var c in check)
                    {
                        DelFDIGetRawMaterial(c.PKNO);
                    }
                    main.PKNO = CBaseData.NewGuid();
                    AddFDIGetRawMaterial(main);
                }

                foreach (var detail in detials)
                {
                    var check = GetFDIGetRawMaterialDetails($"DocEntry = '{detail.DocEntry}' and LineId = '{detail.LineId}'");
                    foreach (var c in check)
                    {
                        DelFDIGetRawMaterialDetail(c.PKNO);
                    }
                    detail.PKNO = CBaseData.NewGuid();
                    AddFDIGetRawMaterialDetail(detail);
                }
            }
            catch (Exception ex)
            {
                NetLog.Error("GetRawMaterial   error", ex);
                return("error: " + ex.Message);
            }

            return("OK");
        }
コード例 #7
0
        //程序启动
        protected override void OnStartup(StartupEventArgs e)
        {
            #region 检测进程是否存在

            string sName  = Assembly.GetExecutingAssembly().FullName;
            bool   runone = true;

            System.Threading.Mutex run = new System.Threading.Mutex(true, sName, out runone);

            if (!runone)
            {
                MessageBox.Show("系统已经在运行中,请查看任务管理器并退出系统【BFM.WPF.MainUI.exe】.", "系统启动",
                                MessageBoxButton.OK, MessageBoxImage.Error);
                System.Environment.Exit(0);
                return;
            }

            run.ReleaseMutex();  //必须需要

            #endregion

            NewMainForm mainForm;

#if !DEBUG
            NetLog.Write("============系统启动=========");
            mainForm = new NewMainForm();
#endif

            System.Threading.ThreadPool.SetMaxThreads(2000, 800);

            #region 获取用户

            try
            {
                WcfClient <ISDMService> _SDMService = new WcfClient <ISDMService>();
                List <SysUser>          mSysUsers   = _SDMService.UseService(s => s.GetSysUsers("USE_FLAG = 1")).ToList();
            }
            catch (Exception ex)
            {
                MessageBox.Show("数据库访问失败,请核实系统配置是否正确。\r\n错误为:" + ex.Message, "系统启动", MessageBoxButton.OK, MessageBoxImage.Error);
                System.Environment.Exit(0);
                return;
            }

            #endregion

            try
            {
                #region 自动升级程序

                //1.检验版本并提示升级
                //VersionManage.UpdateAppVersion(true);  //检验版本
                //2.开启后台检查版本
                //VersionManage.AutoUpdateVersion(); //自动升级版本

                #endregion

#if DEBUG
                NetLog.Write("系统为DEBUG,请使用Release...");
                mainForm = new NewMainForm();
#endif

                mainForm.ShowDialog();
            }
            catch (Exception ex)
            {
                NetLog.Error("系统错误,", ex);

                WPFMessageBox.ShowError(
                    $"系统错误,请核实。" + Environment.NewLine +
                    $"错误为:" + ex.Message, "系统错误");
            }
        }
コード例 #8
0
        public string GetWorkOrder(string jsWOMain, string jsWODetail)
        {
            NetLog.Write("GetWorkOrder" + "   " + jsWOMain);
            NetLog.Write("GetWorkOrder" + "   " + jsWODetail);
            List <FDIGetWOrder>       mains   = new List <FDIGetWOrder>();
            List <FDIGetWOrderDetail> detials = new List <FDIGetWOrderDetail>();

            //String jsWOMain = "[{\r\n" +
            //    "\"DocEntry\": \"5\",\r\n" +
            //    "\"ItemCode\": \"P00000001\",\r\n" +
            //    "\"Status\": \"L\",\r\n" +
            //    "\"Type\": \"S\",\r\n" +
            //    "\"PlannedQty\": \"100.000000\",\r\n" +
            //    "	\"Comments\": \"\",\"RlsDate\": \"2019-03-26\",\r\n" +
            //    "		\"Warehouse\": \"W001\",\r\n" +
            //    "\"Project\": \"\",\r\n" +
            //    "\"OcrCode\": \"\",\r\n" +
            //    "\"OcrCode2\": \"\",\r\n" +
            //    "	\"OcrCode3\": \"\",\"OcrCode4\": \"\",\r\n" +
            //    "\"OcrCode5\": \"\",\r\n" +
            //    "\"OriginNum\": \"-1\",\r\n" +
            //    "\"Cardcode\": \"\",\r\n" +
            //    "\"UserSign\": \"9\",\r\n" +
            //    "\"StartDate\": \"2019-03-26\",\"DueDate\": \"2019-03-26\",\r\n" +
            //    "\"DocTime\": \"142602\",\r\n" +
            //    "\"Udf1\": \"\",\r\n" +
            //    "\"Udf2\": \"\",\r\n" +
            //    "\"Udf3\": \"\",\r\n" +
            //    "\"Udf4\": \"\",\r\n" +
            //    "	\"Udf5\": \"\"\r\n" +
            //    "}\r\n" +
            //    "]";
            //String jsWODetail = "[{\r\n" +
            //    "\"DocEntry\": \"5\",\r\n" +
            //    "\"LineNum\": \"0\",\r\n" +
            //    "		\"ItemCode\": \"M00000001\",\r\n" +
            //    "		\"ItemName\": \"16寸轮毂毛坯\",\r\n" +
            //    "		\"BaseQty\": \"1.000000\",\r\n" +
            //    "		\"PlannedQty\": \"100.000000\",\r\n" +
            //    "		\"WareHouse\": \"W001\",\r\n" +
            //    "		\"Project\": \"\",\r\n" +
            //    "		\"OcrCode\": \"\",\r\n" +
            //    "		\"OcrCode2\": \"\",\r\n" +
            //    "		\"OcrCode3\": \"\",\r\n" +
            //    "		\"OcrCode4\": \"\",\r\n" +
            //    "		\"OcrCode5\": \"\",\r\n" +
            //    "		\"Udf1\": \"\",\r\n" +
            //    "		\"Udf2\": \"\",\r\n" +
            //    "		\"Udf3\": \"\",\r\n" +
            //    "		\"Udf4\": \"\",\r\n" +
            //    "		\"Udf5\": \"\"\r\n" +
            //    "	}\r\n" +
            //    "]";



            try
            {
                mains   = SafeConverter.JsonDeserializeObject <List <FDIGetWOrder> >(jsWOMain);
                detials = SafeConverter.JsonDeserializeObject <List <FDIGetWOrderDetail> >(jsWODetail);

                foreach (var main in mains)
                {
                    var check = GetFDIGetWOrders($"DocEntry = '{main.DocEntry}'");
                    foreach (var c in check)
                    {
                        DelFDIGetWOrder(c.PKNO);
                    }
                    main.PKNO = CBaseData.NewGuid();
                    AddFDIGetWOrder(main);
                }

                foreach (var detail in detials)
                {
                    var check = GetFDIGetWOrderDetails($"DocEntry = '{detail.DocEntry}'and LineNum =  '{detail.LineNum}'");
                    foreach (var c in check)
                    {
                        DelFDIGetWOrderDetail(c.PKNO);
                    }
                    detail.PKNO = CBaseData.NewGuid();
                    AddFDIGetWOrderDetail(detail);
                }
            }
            catch (Exception ex)
            {
                NetLog.Error("GetRawMaterial   error", ex);
                return("error: " + ex.Message);
            }

            return("OK");
        }