//Accept里调用;根据messageContent执行相应业务逻辑
        private void Receive(string remoteEndPoint, string info)
        {
            Dictionary <string, string> message;
            MessageContent messageContent;
            MessageType    messageType;

            message = MessageTranslate.AnalyseInfo(info, out messageContent, out messageType);
            IReceiveInfo receiveInfo = new ReceiveInfo(message, remoteEndPoint);

            switch (messageContent)
            {
            case MessageContent.错误:
                Terminal.ClientPrint(remoteEndPoint, InfoType.发送, info);
                break;

            case MessageContent.登录:
                if (messageType == MessageType.请求)
                {
                    LoginRequest(receiveInfo, runningData.Clients_remoteEndPoint[remoteEndPoint]);
                }
                break;

            case MessageContent.创建答疑室:
                if (messageType == MessageType.请求)
                {
                    CreateRoomRequest(receiveInfo, runningData.Clients_remoteEndPoint[remoteEndPoint]);
                }
                break;

            case MessageContent.加入答疑室:
                if (messageType == MessageType.请求)
                {
                    JoinRoomRequest(receiveInfo, runningData.Clients_remoteEndPoint[remoteEndPoint]);
                }
                break;

            case MessageContent.退出答疑室:
                if (messageType == MessageType.通知)
                {
                    ExitRoomInform(receiveInfo, runningData.Clients_remoteEndPoint[remoteEndPoint]);
                }
                break;

            case MessageContent.静音某人:
                if (messageType == MessageType.通知)
                {
                    MuteUserInform(receiveInfo, runningData.Clients_remoteEndPoint[remoteEndPoint]);
                }
                break;

            case MessageContent.发言请求:
                if (messageType == MessageType.通知)
                {
                    SpeakInform(receiveInfo, runningData.Clients_remoteEndPoint[remoteEndPoint]);
                }
                break;
            }
        }
 /// <summary>
 /// ReceiveInfo-->EmergencyPullingCartInfo
 /// </summary>
 /// <param name="receiveInfo"></param>
 /// <param name="info"></param>
 public static void GetEmergencyPullingCartByReceive(ReceiveInfo receiveInfo, ref EmergencyPullingCartInfo info)
 {
     if (receiveInfo == null)
     {
         return;
     }
     ///PULL_MODE,拉动方式
     //info.PullMode = receiveInfo.PullMode.GetValueOrDefault();
     /////PART_BOX_CODE,零件类代码
     //info.PartBoxCode = receiveInfo.PartBoxCode;
 }
        public JsonResults <List <TanksAction> > Action(ReceiveInfo receiveInfo)
        {
            try
            {
                Stopwatch watch = new Stopwatch();
                watch.Start();
                GameInfo           gameInfo     = new GameInfo(receiveInfo);
                List <TanksAction> tanksActions = new List <TanksAction>();
                TanksAction        tanksAction  = null;
                foreach (TankInfo info in SharedResources.OurTanks)
                {
                    tanksAction = info.GetAction(gameInfo);
                    if (tanksAction != null)
                    {
                        tanksActions.Add(tanksAction);
                    }
                }

                JsonResults <List <TanksAction> > ret = new JsonResults <List <TanksAction> >
                {
                    Action = @"/action",
                    Code   = "0",
                    Msg    = "succeeded",
                    OK     = true,
                    Data   = tanksActions
                };
                watch.Stop();
                Debug.WriteLine(watch.ElapsedMilliseconds);
                return(ret);
            }
            catch (Exception ex)
            {
                List <TanksAction> tanksActions = new List <TanksAction>();
                foreach (TankInfo info in SharedResources.OurTanks)
                {
                    tanksActions.Add(new TanksAction {
                        ActionType = ActionTypeEnum.FIRE.ToString(),
                        Direction  = "UP",
                        Length     = info.SheCheng,
                        TId        = info.TId,
                        UseGlod    = false
                    });
                }
                JsonResults <List <TanksAction> > ret = new JsonResults <List <TanksAction> >
                {
                    Action = @"/action",
                    Code   = "0",
                    Msg    = "succeeded",
                    OK     = true,
                    Data   = tanksActions
                };
                return(ret);
            }
        }
        /// <summary>
        /// ReceiveInfo=>TranDetailsInfo
        /// </summary>
        /// <param name="receiveInfo"></param>
        /// <param name="tranDetailsInfo"></param>
        /// <returns></returns>
        public static void GetTranDetailsInfo(ReceiveInfo receiveInfo, ref TranDetailsInfo tranDetailsInfo)
        {
            ///交易时间
            tranDetailsInfo.TranDate = receiveInfo.TranTime;
            if (tranDetailsInfo.TranDate == null)
            {
                tranDetailsInfo.TranDate = DateTime.Now;
            }
            ///成本中心
            //tranDetailsInfo.CostCenter = receiveInfo.CostCenter;
            ///单据号
            if (string.IsNullOrEmpty(tranDetailsInfo.TranNo))
            {
                tranDetailsInfo.TranNo = receiveInfo.ReceiveNo;
            }
            ///保管员
            tranDetailsInfo.Keeper = receiveInfo.BookKeeper;
            ///仓储单据类型,INBOUND+1000,OUTBOUND+2000
            tranDetailsInfo.TranOrderType = receiveInfo.ReceiveType.GetValueOrDefault() + 1000;
            ///若有入库单来源则对交易单据类型进行重新标识
            //if (receiveInfo.SourceCreateType != null)
            //    tranDetailsInfo.TranOrderType = receiveInfo.ReceiveType.GetValueOrDefault() + receiveInfo.SourceCreateType.GetValueOrDefault() * 100;
            ///拉动方式
            //tranDetailsInfo.RunsheetType = receiveInfo.PullMode;
            ///特殊入库类型处理
            switch (receiveInfo.ReceiveType.GetValueOrDefault())
            {
            ///返利入库 -> 无价值物料入库
            case (int)InboundTypeConstants.RebateInbound:
                tranDetailsInfo.TranType    = (int)WmmTranTypeConstants.Inbound;
                tranDetailsInfo.SettledFlag = true;    ///无价值入库为已结算状态,无须付款而已
                break;

            ///物料预留 -> 冻结入库
            case (int)InboundTypeConstants.ReserveInbound:
                tranDetailsInfo.TranType    = (int)WmmTranTypeConstants.FrozenInbound;
                tranDetailsInfo.SettledFlag = true;    ///物料预留需要结算
                break;

            ///采购订单 -> 物料入库
            case (int)InboundTypeConstants.PurchaseOrder:
                tranDetailsInfo.TranType    = (int)WmmTranTypeConstants.Inbound;
                tranDetailsInfo.SettledFlag = true;    ///需要结算
                break;

            default:
                tranDetailsInfo.TranType    = (int)WmmTranTypeConstants.Inbound;
                tranDetailsInfo.SettledFlag = null;
                break;
            }
        }
        public JsonResults <string> Init(ReceiveInfo receiveInfo)
        {
            JsonResults <string> json = new JsonResults <string>
            {
                Action = @"/init",
                Code   = "0",
                Msg    = "succeeded",
                OK     = true,
                Data   = null
            };
            GameInfo tanks = new GameInfo(receiveInfo);

            return(json);
        }
Exemple #6
0
        /// <summary>
        /// 获取入库单转紧急计划拉动单执行语句
        /// </summary>
        /// <param name="receiveInfo"></param>
        /// <param name="receiveDetailInfos"></param>
        /// <param name="loginUser"></param>
        /// <returns></returns>
        public static string GetEmergencyPullSql(ReceiveInfo receiveInfo, List <ReceiveDetailInfo> receiveDetailInfos, string loginUser)
        {
            StringBuilder @string = new StringBuilder();
            ///创建计划拉动单
            PlanPullOrderInfo planPullOrderInfo = CreatePlanPullOrderInfo(loginUser);

            ///以入库单信息填充计划拉动单
            GetPlanPullOrderInfo(receiveInfo, ref planPullOrderInfo);
            ///PlanPartBoxInfo -> PlanPullOrderInfo
            //PlanPartBoxInfo planPartBoxInfo = new PlanPartBoxDAL().GetInfo(receiveInfo.PartBoxCode);
            PlanPartBoxInfo planPartBoxInfo = new  PlanPartBoxInfo();

            GetPlanPullOrderInfo(planPartBoxInfo, ref planPullOrderInfo);
            ///
            int     sumPackageQty = 0;
            decimal sumPartQty    = 0;

            foreach (var receiveDetailInfo in receiveDetailInfos)
            {
                if (receiveDetailInfo.RequiredQty.GetValueOrDefault() <= receiveDetailInfo.ActualQty.GetValueOrDefault())
                {
                    continue;
                }
                ///创建计划拉动单明细
                PlanPullOrderDetailInfo planPullOrderDetailInfo = PlanPullOrderDetailBLL.CreatePlanPullOrderDetailInfo(loginUser);
                ///ReceiveDetailInfo -> PlanPullOrderDetailInfo
                PlanPullOrderDetailBLL.GetPlanPullOrderDetailInfo(receiveDetailInfo, ref planPullOrderDetailInfo);
                ///PlanPullOrderInfo -> PlanPullOrderDetailInfo
                PlanPullOrderDetailBLL.GetPlanPullOrderDetailInfo(planPullOrderInfo, ref planPullOrderDetailInfo);
                ///
                @string.AppendLine(PlanPullOrderDetailDAL.GetInsertSql(planPullOrderDetailInfo));
                sumPackageQty += planPullOrderDetailInfo.RequiredPackageQty.GetValueOrDefault();
                sumPartQty    += planPullOrderDetailInfo.RequiredPartQty.GetValueOrDefault();
            }
            if (@string.Length == 0)
            {
                return(string.Empty);
            }
            ///SUM_PACKAGE_QTY
            planPullOrderInfo.SumPackageQty = sumPackageQty;
            ///SUM_PART_QTY
            planPullOrderInfo.SumPartQty = sumPartQty;
            @string.AppendLine(PlanPullOrderDAL.GetInsertSql(planPullOrderInfo));
            return(@string.ToString());
        }
Exemple #7
0
 /// <summary>
 /// ReceiveInfo -> PlanPullOrderInfo
 /// </summary>
 /// <param name="receiveInfo"></param>
 /// <param name="planPullOrderInfo"></param>
 public static void GetPlanPullOrderInfo(ReceiveInfo receiveInfo, ref PlanPullOrderInfo planPullOrderInfo)
 {
     ///Fid
     planPullOrderInfo.Fid = receiveInfo.Fid;
     ///ORDER_CODE
     planPullOrderInfo.OrderCode = new SeqDefineDAL().GetCurrentCode("PLAN_PULL_ORDER_CODE");
     ///PART_BOX_CODE
     //planPullOrderInfo.PartBoxCode = receiveInfo.PartBoxCode;
     /////PART_BOX_NAME
     //planPullOrderInfo.PartBoxName = receiveInfo.PartBoxName;
     ///PLANT
     planPullOrderInfo.Plant = receiveInfo.Plant;
     ///SUPPLIER_NUM
     planPullOrderInfo.SupplierNum = receiveInfo.SupplierNum;
     ///SOURCE_ZONE_NO
     //planPullOrderInfo.SourceZoneNo = receiveInfo.SourceZoneNo;
     /////SOURCE_WM_NO
     //planPullOrderInfo.SourceWmNo = receiveInfo.SourceWmNo;
     ///TARGET_ZONE_NO
     planPullOrderInfo.TargetZoneNo = receiveInfo.ZoneNo;
     ///TARGET_WM_NO
     planPullOrderInfo.TargetWmNo = receiveInfo.WmNo;
     ///PUBLISH_TIME
     planPullOrderInfo.PublishTime = DateTime.Now;
     ///ORDER_TYPE
     planPullOrderInfo.OrderType = (int)PullOrderTypeConstants.Emergency;
     ///DOCK
     planPullOrderInfo.Dock = receiveInfo.Dock;
     ///SUGGEST_DELIVERY_TIME
     planPullOrderInfo.SuggestDeliveryTime = DateTime.Now;
     ///ORDER_STATUS
     planPullOrderInfo.OrderStatus = (int)PullOrderStatusConstants.Released;
     ///ASN_FLAG
     planPullOrderInfo.AsnFlag = false;
     ///KEEPER
     planPullOrderInfo.Keeper = receiveInfo.BookKeeper;
     ///ROUTE_CODE
     //planPullOrderInfo.RouteCode = receiveInfo.Route;
     /////ROUTE_NAME
     //planPullOrderInfo.RouteName = receiveInfo.RouteName;
     /////CUST_CODE
     //planPullOrderInfo.CustCode = receiveInfo.CustCode;
     /////CUST_SNAME
     //planPullOrderInfo.CustSname = receiveInfo.CustName;
 }
Exemple #8
0
        public string GetPayFormHtml(Hashtable ht)
        {
            //商户号
            string partner = ht["alipay_key"] as string;
            //密钥
            string key = ht["alipay_secret"] as string;


            AlipayConfig.Partner = partner;// +"5";
            AlipayConfig.Key     = key;


            decimal product_fee   = (decimal)ht["order_fee"];                          //商品费用
            decimal transport_fee = decimal.Parse(ht["order_exp_fee"].ToString());     //物流费用

            string order_desc = ht["order_desc"] as string;

            //订单号,此处用时间和随机数生成,商户根据自己调整,保证唯一
            string out_trade_no = ht["order_no"] as string;
            string host         = ht["usr_host"] as string;

            string showUrl = ht["order_surl"] as string;

            string notify_url = ht.Contains("notify_url")?ht["notify_url"].ToString():PayUtil.GetNotifyUrl(PayMethods.Alipay, PayApiType.Guarantee);

            //需http://格式的完整路径,不能加?id=123这类自定义参数

            //页面跳转同步通知页面路径
            string return_url = ht.Contains("return_url")?ht["return_url"].ToString():PayUtil.GetReturnUrl(PayMethods.Alipay, PayApiType.Guarantee);
            //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/


            //卖家支付宝帐户
            string seller_email = ht["seller_account"] as string;

            //订单描述、订单详细、订单备注,显示在支付宝收银台里的“商品描述”里
            string subject = ht["order_subject"].ToString();  //parma.desc ?? "支付订单";

            //当前时间 yyyyMMdd
            string date = DateTime.Now.ToString("yyyyMMdd");
            //todo
            string body = order_desc;

            //订单总金额,显示在支付宝收银台里的“应付总额”里
            string total_fee = Convert.ToString(product_fee + transport_fee);


            ReceiveInfo receive = default(ReceiveInfo);

            if (ht.ContainsKey("receive"))
            {
                receive = (ReceiveInfo)ht["receive"];
            }



            ////////////////////////////////////////////请求参数////////////////////////////////////////////

            //支付类型
            string payment_type = "1";

            //必填

            //商品数量
            string quantity = "1";
            //必填,建议默认为1,不改变值,把一次交易看成是一次下订单而非购买一件商品
            //物流费用
            string logistics_fee = "0.00";
            //必填,即运费
            //物流类型
            string logistics_type = "EXPRESS";
            //必填,三个值可选:EXPRESS(快递)、POST(平邮)、EMS(EMS)
            //物流支付方式
            string logistics_payment = "SELLER_PAY";
            //必填,两个值可选:SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)
            //订单描述



            ////////////////////////////////////////////////////////////////////////////////////////////////

            //把请求参数打包成数组
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("partner", AlipayConfig.Partner);
            sParaTemp.Add("_input_charset", AlipayConfig.Input_charset.ToLower());
            sParaTemp.Add("service", "create_partner_trade_by_buyer");
            sParaTemp.Add("payment_type", payment_type);
            sParaTemp.Add("notify_url", notify_url);
            sParaTemp.Add("return_url", return_url);
            sParaTemp.Add("seller_email", seller_email);
            sParaTemp.Add("out_trade_no", out_trade_no);
            sParaTemp.Add("subject", subject);
            sParaTemp.Add("price", total_fee);
            sParaTemp.Add("quantity", quantity);
            sParaTemp.Add("logistics_fee", logistics_fee);
            sParaTemp.Add("logistics_type", logistics_type);
            sParaTemp.Add("logistics_payment", logistics_payment);
            sParaTemp.Add("body", body);
            sParaTemp.Add("show_url", showUrl);
            sParaTemp.Add("receive_name", receive.Name);
            sParaTemp.Add("receive_address", receive.Address);
            sParaTemp.Add("receive_zip", receive.Zip);
            sParaTemp.Add("receive_phone", receive.Phone);
            sParaTemp.Add("receive_mobile", receive.Mobile);


            //建立请求
            return(Submit.BuildRequest(sParaTemp, "get", "确认"));
        }
        public void Deploy(string deployer)
        {
            var         tracer     = _traceFactory.GetTracer();
            IDisposable deployStep = null;

            try
            {
                deployStep = tracer.Step("Deploy");
                ReceiveInfo receiveInfo = _serverRepository.GetReceiveInfo();

                string targetBranch = _settings.GetValue("branch") ?? "master";

                tracer.Trace("Deploying branch '{0}'", targetBranch);

                // Something went wrong here since we weren't able to deploy if receiveInfo is null
                if (receiveInfo == null || !targetBranch.Equals(receiveInfo.Branch.Name, StringComparison.OrdinalIgnoreCase))
                {
                    if (receiveInfo == null)
                    {
                        tracer.TraceWarning("Push info was null. Post receive hook didn't execute correctly");
                    }
                    else
                    {
                        tracer.Trace("Unexpected branch deployed '{0}'.", receiveInfo.Branch.Name);

                        _globalLogger.Log(Resources.Log_UnexpectedBranchPushed, receiveInfo.Branch.Name, targetBranch);
                    }

                    ReportCompleted();
                    deployStep.Dispose();
                    return;
                }

                // Get the pushed branch's id
                string id = receiveInfo.Branch.Id;
                // If nothing changed then do nothing
                if (IsActive(id))
                {
                    tracer.Trace("Deployment '{0}' already active", id);

                    _globalLogger.Log(Resources.Log_DeploymentAlreadyActive, id);

                    ReportCompleted();
                    deployStep.Dispose();
                    return;
                }

                ILogger logger = CreateAndPopulateStatusFile(tracer, id, deployer);

                using (tracer.Step("Update to " + receiveInfo.Branch.Name))
                {
                    logger.Log(Resources.Log_UpdatingBranch, receiveInfo.Branch.Name);

                    using (var progressWriter = new ProgressWriter())
                    {
                        progressWriter.Start();

                        // Update to the target branch
                        _serverRepository.Update(targetBranch);
                    }
                }

                Build(id, tracer, deployStep);
            }
            catch (Exception ex)
            {
                _globalLogger.Log(ex);

                tracer.TraceError(ex);

                if (deployStep != null)
                {
                    deployStep.Dispose();
                }

                ReportCompleted();
            }
        }
Exemple #10
0
        /// <summary>
        /// GetReceiveCompleteDealSql
        /// </summary>
        /// <param name="vmiReceiveInfo"></param>
        /// <param name="vmiReceiveDetailInfos"></param>
        /// <param name="barcodeInfos"></param>
        /// <param name="loginUser"></param>
        /// <param name="emergencyFlag"></param>
        /// <returns></returns>
        public string GetReceiveCompleteDealSql(VmiReceiveInfo vmiReceiveInfo, List <VmiReceiveDetailInfo> vmiReceiveDetailInfos, List <BarcodeInfo> barcodeInfos, string loginUser)
        {
            ///获取系统配置
            Dictionary <string, string> configs = new ConfigDAL().GetValuesByCodes(new string[] {
                "VALID_VMI_RECEIVE_ACTUAL_QTY_EQUAL_SCANED_QTY_FLAG",
                "LES_TRAN_DATA_ENABLE_FLAG",
                "VMI_RECEIVE_MATERIAL_RECHECK_INSPECT_MODE",
                "INBOUND_SYNC_OUTBOUND_ENABLE_FLAG",
                "ENABLE_VMI_PACKAGE_MANAGEMENT_FLAG"
            });
            ///入库单客户端提交时处理语句
            ///WEB端为完成操作
            ///TODO:考虑增加是否支持单据多次收货的开关
            StringBuilder @string = new StringBuilder();

            ///更新入库单状态
            @string.AppendLine(GetReceiveStatusUpdateSql(vmiReceiveInfo.Id, WmmOrderStatusConstants.Completed, loginUser));
            ///
            foreach (VmiReceiveDetailInfo vmiReceiveDetailInfo in vmiReceiveDetailInfos)
            {
                List <BarcodeInfo> barcodes = barcodeInfos.Where(d => d.CreateSourceFid.GetValueOrDefault() == vmiReceiveDetailInfo.Fid.GetValueOrDefault()).ToList();
                if (barcodes.Count == 0)
                {
                    barcodes = barcodeInfos.Where(w => w.AsnRunsheetNo == vmiReceiveDetailInfo.TranNo &&
                                                  w.PartNo == vmiReceiveDetailInfo.PartNo &&
                                                  w.SupplierNum == vmiReceiveDetailInfo.SupplierNum &&
                                                  w.RunsheetNo == vmiReceiveDetailInfo.RunsheetNo).ToList();
                }

                ///是否校验VMI实收数量等于扫描数量
                configs.TryGetValue("VALID_VMI_RECEIVE_ACTUAL_QTY_EQUAL_SCANED_QTY_FLAG", out string valid_vmi_receive_actual_qty_equal_scaned_qty_flag);
                if (!string.IsNullOrEmpty(valid_vmi_receive_actual_qty_equal_scaned_qty_flag) && valid_vmi_receive_actual_qty_equal_scaned_qty_flag.ToLower() == "true")
                {
                    if (barcodes.Sum(d => d.CurrentQty.GetValueOrDefault()) != vmiReceiveDetailInfo.ActualQty.GetValueOrDefault())
                    {
                        throw new Exception("MC:0x00000258");///标签扫描数量与单据不一致
                    }
                    if (barcodes.Count != vmiReceiveDetailInfo.ActualBoxNum.GetValueOrDefault())
                    {
                        throw new Exception("MC:0x00000258");///标签扫描数量与单据不一致
                    }
                }

                ///入库单号、零件号、供应商、单号
                foreach (BarcodeInfo barcodeInfo in barcodes)
                {
                    ///来源不为空时获取来源
                    if (!string.IsNullOrEmpty(vmiReceiveDetailInfo.WmNo) && !string.IsNullOrEmpty(vmiReceiveDetailInfo.ZoneNo))
                    {
                        @string.AppendLine(BarcodeDAL.GetBarcodeUpdateSql(
                                               (int)BarcodeStatusConstants.Inbound,
                                               vmiReceiveDetailInfo.WmNo,
                                               vmiReceiveDetailInfo.ZoneNo,
                                               vmiReceiveDetailInfo.Dloc,
                                               vmiReceiveDetailInfo.TranNo,
                                               barcodeInfo.Fid.GetValueOrDefault(),
                                               loginUser));
                    }
                    else
                    {
                        @string.AppendLine(BarcodeDAL.GetBarcodeUpdateSql(
                                               (int)BarcodeStatusConstants.Inbound,
                                               vmiReceiveDetailInfo.TargetWm,
                                               vmiReceiveDetailInfo.TargetZone,
                                               vmiReceiveDetailInfo.TargetDloc,
                                               vmiReceiveDetailInfo.TranNo,
                                               barcodeInfo.Fid.GetValueOrDefault(),
                                               loginUser));
                    }
                }

                ///更新入库单明细信息
                @string.AppendLine(GetReceiveDetailActualQtyUpdateSql(
                                       vmiReceiveDetailInfo.Id,
                                       vmiReceiveDetailInfo.ActualBoxNum.GetValueOrDefault(),
                                       vmiReceiveDetailInfo.ActualQty.GetValueOrDefault(),
                                       loginUser));
            }
            ///转换为普通入库单进行处理
            List <ReceiveDetailInfo> receiveDetailInfos = ReceiveDetailBLL.GetReceiveDetailInfos(vmiReceiveDetailInfos);
            ReceiveInfo receiveInfo = ReceiveBLL.CreateReceiveInfo(loginUser);

            ReceiveBLL.GetReceiveInfo(vmiReceiveInfo, ref receiveInfo);
            ///是否启用LES交易记录创建
            configs.TryGetValue("LES_TRAN_DATA_ENABLE_FLAG", out string les_tran_data_enable_flag);
            if (!string.IsNullOrEmpty(les_tran_data_enable_flag) && les_tran_data_enable_flag.ToLower() == "true")
            {
                @string.AppendLine(ReceiveBLL.GetTranDetailsInsertSql(receiveInfo, receiveDetailInfos, (int)WmmTranTypeConstants.Inbound, loginUser));
            }

            ///系统配置中RECEIVE_MATERIAL_RECHECK_INSPECT_MODE入库免检物料重新校验检验模式标记,默认为true
            ///若该标记为true时将入库明细中的㊺免检物料比对检验模式基础数据中物料的当前检验模式
            ///若检验模式有变化则需要将变化的物料提交至QMIS检验任务中间表,并生成同步数据任务,否则忽略此逻辑(此项逻辑可以考虑异步实现)
            ///VMI入库免检物料重新校验检验模式标记
            configs.TryGetValue("VMI_RECEIVE_MATERIAL_RECHECK_INSPECT_MODE", out string vmi_receive_material_recheck_inspect_mode);
            if (!string.IsNullOrEmpty(vmi_receive_material_recheck_inspect_mode) && vmi_receive_material_recheck_inspect_mode.ToLower() == "true")
            {
                @string.AppendLine(PartInspectionModeBLL.ReloadInspectionMode(receiveInfo, ref receiveDetailInfos, loginUser));
            }

            ///将入库明细中是否产生出库单标记㊵为true的数据过滤出来,系统配置中SAME_ZONE_SAME_FINAL_ZONE_VALID_FLAG相同存储区相同中转存储区验证标记,
            ///默认为true,控制了同一张入库单的明细中不会出现不同的出库目标存储区㊷,
            ///所以此时只需直接根据入库单及明细复制出相应的出库单及明细,并以出库目标存储区㊷作为出库单的目标存储区入库实际数量⑱作为出库需求数量,
            ///若系统配置标记为false,则将过滤出来的入库明细数据根据其出库目标存储区进行分组,并按分组情况生成多个出库单,出库单状态为已发布WMM - 011
            ///入库后同步生成出库指令启用标记
            configs.TryGetValue("INBOUND_SYNC_OUTBOUND_ENABLE_FLAG", out string inboundSyncOutboundEnableFlag);
            if (!string.IsNullOrEmpty(inboundSyncOutboundEnableFlag) && inboundSyncOutboundEnableFlag.ToLower() == "true")
            {
                @string.AppendLine(OutputBLL.CreateOutputByReceiveSql(receiveInfo, receiveDetailInfos, barcodeInfos, loginUser));
            }

            ///系统配置ENABLE_PACKAGE_MANAGEMENT_FLAG是否启用器具管理标记,默认为true
            ///若该标记为ture时需要根据实收包装数量⑰以及包装型号⑲等数据产生器具包装随货入库交易数据PCM-002
            ///是否启用VMI器具管理标记
            configs.TryGetValue("ENABLE_VMI_PACKAGE_MANAGEMENT_FLAG", out string enablePackageManagementFlag);
            if (!string.IsNullOrEmpty(enablePackageManagementFlag) && enablePackageManagementFlag.ToLower() == "true")
            {
                @string.AppendLine(PackageTranDetailBLL.CreatePackageTranDetailsSql(receiveDetailInfos, loginUser));
            }

            return(@string.ToString());
        }
Exemple #11
0
        /// <summary>
        /// 发布(提交)
        /// </summary>
        /// <param name="id"></param>
        /// <param name="loginUser"></param>
        /// <returns></returns>
        public bool ReleaseInfos(List <string> rowsKeyValues, string loginUser)
        {
            ///入库单
            List <VmiReceiveInfo> vmiReceiveInfos = dal.GetList("[ID] in (" + string.Join(",", rowsKeyValues.ToArray()) + ")", "[ID]");

            if (vmiReceiveInfos.Count == 0)
            {
                throw new Exception("MC:0x00000084");///数据错误
            }
            ///入库单明细
            List <VmiReceiveDetailInfo> vmiReceiveDetailInfos = new VmiReceiveDetailDAL().GetList("[RECEIVE_FID] in ('" + string.Join("','", vmiReceiveInfos.Select(d => d.Fid.GetValueOrDefault()).ToArray()) + "')", "[ID]");

            if (vmiReceiveDetailInfos.Count == 0)
            {
                throw new Exception("MC:0x00000367");///入库单没有明细
            }
            ///获取系统配置
            Dictionary <string, string> configs = new ConfigDAL().GetValuesByCodes(new string[] {
                "RELEASE_VMI_RECEIVE_ACTUAL_QTY_EQUALS_REQUIRED",
                "MANUAL_VMI_RECEIVE_ORDER_RELEASE_CREATE_BARCODE",
                "RELEASE_VMI_RECEIVE_LOAD_PART_INSPECTION_MODE"
            });
            ///已生成的标签
            List <BarcodeInfo> barcodeInfos = new BarcodeDAL().GetList("" +
                                                                       "[BARCODE_STATUS] = " + (int)BarcodeStatusConstants.Created + " and " +
                                                                       "[CREATE_SOURCE_FID] in ('" + string.Join("','", vmiReceiveDetailInfos.Select(d => d.Fid.GetValueOrDefault()).ToArray()) + "')", string.Empty);

            ///执行语句
            StringBuilder @string = new StringBuilder();

            foreach (var vmiReceiveInfo in vmiReceiveInfos)
            {
                ///一般手工创建入库单会用到此功能,入库单必须为10.已创建状态⑫
                if (vmiReceiveInfo.Status.GetValueOrDefault() != (int)WmmOrderStatusConstants.Created)
                {
                    throw new Exception("MC:0x00000683");///状态必须为已创建
                }
                ///VMI入库单明细
                List <VmiReceiveDetailInfo> vmiReceiveDetails = vmiReceiveDetailInfos.Where(d => d.ReceiveFid.GetValueOrDefault() == vmiReceiveInfo.Fid.GetValueOrDefault()).ToList();
                ///VMI入库单对应的标签数据
                List <BarcodeInfo> barcodes = barcodeInfos.Where(d => vmiReceiveDetails.Select(f => f.Fid.GetValueOrDefault()).Contains(d.CreateSourceFid.GetValueOrDefault())).ToList();
                ///将VMI入库单明细对象转换为普通入库单对象,方便后续函数处理
                List <ReceiveDetailInfo> receiveDetailInfos = ReceiveDetailBLL.GetReceiveDetailInfos(vmiReceiveDetails);
                ///手工创建VMI入库单时创建条码标签
                configs.TryGetValue("MANUAL_VMI_RECEIVE_ORDER_RELEASE_CREATE_BARCODE", out string manual_vmi_receive_order_release_create_barcode);
                if (!string.IsNullOrEmpty(manual_vmi_receive_order_release_create_barcode) && manual_vmi_receive_order_release_create_barcode.ToLower() == "true")
                {
                    @string.AppendLine(MaterialPullingCommonBLL.GetCreateBarcodesSql(receiveDetailInfos, barcodes, loginUser));
                }
                ///
                ReceiveInfo receiveInfo = ReceiveBLL.CreateReceiveInfo(loginUser);
                ///VmiReceiveInfo -> ReceiveInfo
                ReceiveBLL.GetReceiveInfo(vmiReceiveInfo, ref receiveInfo);
                ///VMI入库单发布时是否加载物料检验模式,TODO:此处函数内有与入库单共用的系统配置
                configs.TryGetValue("RELEASE_VMI_RECEIVE_LOAD_PART_INSPECTION_MODE", out string release_vmi_receive_load_part_inspection_mode);
                if (!string.IsNullOrEmpty(release_vmi_receive_load_part_inspection_mode) && release_vmi_receive_load_part_inspection_mode.ToLower() == "true")
                {
                    @string.AppendLine(PartInspectionModeBLL.LoadInspectionMode(ref receiveInfo, ref receiveDetailInfos, loginUser));
                }
                ///行号更新
                int rowNo = 0;
                ///发布VMI入库单时实收数量默认等于需求数量
                configs.TryGetValue("RELEASE_VMI_RECEIVE_ACTUAL_QTY_EQUALS_REQUIRED", out string release_vmi_receive_actual_qty_equals_required);
                foreach (var receiveDetailInfo in receiveDetailInfos)
                {
                    if (!string.IsNullOrEmpty(release_vmi_receive_actual_qty_equals_required) && release_vmi_receive_actual_qty_equals_required.ToLower() == "true")
                    {
                        if (receiveDetailInfo.ActualBoxNum == null)
                        {
                            receiveDetailInfo.ActualBoxNum = receiveDetailInfo.RequiredBoxNum;
                        }
                        if (receiveDetailInfo.ActualQty == null)
                        {
                            receiveDetailInfo.ActualQty = receiveDetailInfo.RequiredQty;
                        }
                    }
                    ///更新入库单明细需要注意不能覆盖明细中原内容
                    @string.AppendLine("update [LES].[TT_WMM_VMI_RECEIVE_DETAIL] set " +
                                       "[ROW_NO] = " + ++rowNo + "," +
                                       (receiveDetailInfo.ActualBoxNum == null ? string.Empty : "[ACTUAL_BOX_NUM] = " + receiveDetailInfo.ActualBoxNum.GetValueOrDefault() + ",") +
                                       (receiveDetailInfo.ActualQty == null ? string.Empty : "[ACTUAL_QTY] = " + receiveDetailInfo.ActualQty.GetValueOrDefault() + ",") +
                                       (receiveDetailInfo.InspectionMode == null ? string.Empty : "[INSPECTION_MODE] = " + receiveDetailInfo.InspectionMode.GetValueOrDefault() + ",") +
                                       (string.IsNullOrEmpty(receiveDetailInfo.SupplierNum) ? "[SUPPLIER_NUM] = N'" + receiveInfo.SupplierNum + "'," : string.Empty) +
                                       "[WM_NO] = N'" + receiveInfo.WmNo + "'," +
                                       "[ZONE_NO] = N'" + receiveInfo.ZoneName + "'," +
                                       "[TARGET_WM] = N'" + receiveInfo.WmNo + "'," +
                                       "[TARGET_ZONE] = N'" + receiveInfo.ZoneNo + "'," +
                                       (string.IsNullOrEmpty(receiveDetailInfo.RunsheetNo) ? "[RUNSHEET_NO] = N'" + receiveInfo.RunsheetNo + "'," : string.Empty) +
                                       "[MODIFY_DATE] = GETDATE()," +
                                       "[MODIFY_USER] = N'" + loginUser + "' where " +
                                       "[ID] = " + receiveDetailInfo.Id + ";");
                }
                ///更新入库单
                @string.AppendLine("update [LES].[TT_WMM_VMI_RECEIVE] set " +
                                   "[SUM_PART_QTY] = " + vmiReceiveDetails.Sum(d => d.RequiredQty.GetValueOrDefault()) + "," +
                                   "[SUM_OF_PRICE] = " + vmiReceiveDetails.Sum(d => d.PartPrice.GetValueOrDefault()) + "," +
                                   "[SUM_WEIGHT] = " + vmiReceiveDetails.Sum(d => d.SumWeight.GetValueOrDefault()) + "," +
                                   "[SUM_VOLUME] = " + vmiReceiveDetails.Sum(d => d.SumVolume.GetValueOrDefault()) + "," +
                                   "[SUM_PACKAGE_QTY] = " + vmiReceiveDetails.Sum(d => d.RequiredBoxNum.GetValueOrDefault()) + "," +
                                   //"[INSPECTION_FLAG] = " + (receiveInfo.InspectionFlag.GetValueOrDefault() ? 1 : 0) + "," +
                                   "[STATUS] = " + (int)WmmOrderStatusConstants.Published + "," +
                                   "[MODIFY_USER] = N'" + loginUser + "' ," +
                                   "[MODIFY_DATE] = GETDATE() where " +
                                   "[ID] = " + vmiReceiveInfo.Id + ";");
            }
            ///删除已删除VMI入库单明细的标签
            @string.AppendLine("update [LES].[TT_WMM_BARCODE] " +
                               "set [VALID_FLAG] = 0 " +
                               "where [CREATE_SOURCE_FID] in (select [FID] from [LES].[TT_WMM_VMI_RECEIVE_DETAIL] with(nolock) " +
                               "where [VALID_FLAG] = 0 and [RECEIVE_FID] in ('" + string.Join("','", vmiReceiveInfos.Select(d => d.Fid.GetValueOrDefault()).ToArray()) + "'));");
            ///执行
            using (TransactionScope trans = new TransactionScope())
            {
                if (@string.Length > 0)
                {
                    CommonDAL.ExecuteNonQueryBySql(@string.ToString());
                }
                trans.Complete();
            }
            return(true);
        }
Exemple #12
0
        /// <summary>
        /// 同步
        /// </summary>
        /// <param name="loginUser"></param>
        public static void Sync(string loginUser)
        {
            ///获取没有处理的送货单数据
            List <SrmBarcodeInfo> srmBarcodeInfos = new SrmBarcodeBLL().GetList("[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Untreated + "", string.Empty);

            if (srmBarcodeInfos.Count == 0)
            {
                return;
            }
            ///获取对应的ASN单据,TODO:单据类型过滤?原始单据号是指?
            List <ReceiveInfo> receiveInfos = new ReceiveBLL().GetList("[ASN_NO] in ('" + string.Join("','", srmBarcodeInfos.Select(d => d.SourceOrderCode).ToArray()) + "')", string.Empty);

            if (receiveInfos.Count == 0)
            {
                return;
            }
            List <ReceiveDetailInfo> receiveDetailInfos = new ReceiveDetailBLL().GetList("[RECEIVE_FID] in ('" + string.Join("','", receiveInfos.Select(d => d.Fid.GetValueOrDefault()).ToArray()) + "')", string.Empty);

            if (receiveDetailInfos.Count == 0)
            {
                return;
            }
            ///供应商
            List <SupplierInfo> supplierInfos = new SupplierBLL().GetList("[SUPPLIER_NUM] in ('" + string.Join("','", receiveInfos.Select(d => d.SupplierNum).ToArray()) + "')", string.Empty);

            if (supplierInfos.Count == 0)
            {
                return;
            }
            ///获取相关物料仓储信息
            List <PartsStockInfo> partsStockInfos = new PartsStockBLL().GetList("" +
                                                                                "[PART_NO] in ('" + string.Join("','", srmBarcodeInfos.Select(d => d.PartNo).ToArray()) + "') and " +
                                                                                "[WM_NO] in ('" + string.Join("','", receiveInfos.Select(d => d.WmNo).ToArray()) + "')", string.Empty);
            ///获取相关包装器具基础信息
            List <PackageApplianceInfo> packageApplianceInfos = new List <PackageApplianceInfo>();

            if (partsStockInfos.Count > 0)
            {
                ///标准包装
                List <string> packageModels = partsStockInfos.
                                              Where(d => !string.IsNullOrEmpty(d.PackageModel)).
                                              Select(d => d.PackageModel).ToList();
                ///入库包装
                packageModels.AddRange(partsStockInfos.
                                       Where(d => !string.IsNullOrEmpty(d.InboundPackageModel) && !packageModels.Contains(d.InboundPackageModel)).
                                       Select(d => d.InboundPackageModel).ToList());
                ///上线包装
                packageModels.AddRange(partsStockInfos.
                                       Where(d => !string.IsNullOrEmpty(d.InhousePackageModel) && !packageModels.Contains(d.InhousePackageModel)).
                                       Select(d => d.InhousePackageModel).ToList());
                ///
                packageApplianceInfos = new PackageApplianceBLL().GetList("[PAKCAGE_NO] in ('" + string.Join("','", packageModels.ToArray()) + "')", string.Empty);
            }
            ///
            StringBuilder @string = new StringBuilder();
            ///
            List <long> dealedIds = new List <long>();

            ///
            foreach (SrmBarcodeInfo srmBarcodeInfo in srmBarcodeInfos)
            {
                ///获取入库单。TODO:需要两个编号才能定位到唯一明细数据
                ReceiveInfo receiveInfo = receiveInfos.FirstOrDefault(d => d.AsnNo == srmBarcodeInfo.SourceOrderCode);
                ///标签数据与ASN单据数据到达LES可能存在先后顺序
                if (receiveInfo == null)
                {
                    continue;
                }
                ReceiveDetailInfo receiveDetailInfo = receiveDetailInfos.FirstOrDefault(d =>
                                                                                        d.PartNo == srmBarcodeInfo.PartNo &&
                                                                                        d.ReceiveFid.GetValueOrDefault() == receiveInfo.Fid.GetValueOrDefault() &&
                                                                                        d.RunsheetNo == srmBarcodeInfo.SourceOrderCode);
                if (receiveDetailInfo == null)
                {
                    continue;
                }
                ///供应商
                SupplierInfo supplierInfo = supplierInfos.FirstOrDefault(d => d.SupplierNum == receiveInfo.SupplierNum);
                if (supplierInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_SRM_BARCODE] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000229' where " +///供应商信息不存在
                                       "[ID] = " + srmBarcodeInfo.Id + ";");
                    continue;
                }
                ///物料仓储信息
                PartsStockInfo partsStockInfo = partsStockInfos.FirstOrDefault(d =>
                                                                               d.PartNo == srmBarcodeInfo.PartNo &&
                                                                               d.SupplierNum == supplierInfo.SupplierNum &&
                                                                               d.WmNo == receiveInfo.WmNo &&
                                                                               d.ZoneNo == receiveInfo.ZoneNo);
                if (partsStockInfo == null)
                {
                    partsStockInfo = partsStockInfos.FirstOrDefault(d =>
                                                                    d.PartNo == srmBarcodeInfo.PartNo &&
                                                                    d.WmNo == receiveInfo.WmNo &&
                                                                    d.ZoneNo == receiveInfo.ZoneNo);
                }
                if (partsStockInfo == null)
                {
                    @string.AppendLine("update [LES].[TI_IFM_SRM_BARCODE] set " +
                                       "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Suspend + "," +
                                       "[PROCESS_TIME] = GETDATE()," +
                                       "[COMMENTS] = N'0x00000370' where " +///没有相关的物料仓储信息
                                       "[ID] = " + srmBarcodeInfo.Id + ";");
                    continue;
                }
                ///创建标签对象
                BarcodeInfo barcodeInfo = BarcodeBLL.CreateBarcodeInfo(loginUser);
                ///SrmBarcodeInfo -> BarcodeInfo
                BarcodeBLL.GetBarcodeInfo(srmBarcodeInfo, ref barcodeInfo);
                ///SupplierInfo -> BarcodeInfo
                BarcodeBLL.GetBarcodeInfo(supplierInfo, ref barcodeInfo);
                ///PartsStockInfo -> BarcodeInfo
                BarcodeBLL.GetBarcodeInfo(partsStockInfo, ref barcodeInfo);
                ///PackageApplianceInfo -> BarcodeInfo
                PackageApplianceInfo packageApplianceInfo = packageApplianceInfos.FirstOrDefault(d => d.PackageNo == partsStockInfo.InboundPackageModel);
                BarcodeBLL.GetBarcodeInfo(packageApplianceInfo, ref barcodeInfo);
                ///
                barcodeInfo.CreateSourceFid = receiveDetailInfo.Fid;
                ///
                @string.AppendLine(BarcodeDAL.GetInsertSql(barcodeInfo));
                dealedIds.Add(srmBarcodeInfo.Id);
            }
            if (dealedIds.Count > 0)
            {
                ///已处理的中间表数据更新为已处理状态
                @string.AppendLine("update [LES].[TI_IFM_SRM_BARCODE] set " +
                                   "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Processed + "," +
                                   "[PROCESS_TIME] = GETDATE() where " +
                                   "[ID] in (" + string.Join(",", dealedIds.ToArray()) + ");");
            }
            ///执行
            using (TransactionScope trans = new TransactionScope())
            {
                if (@string.Length > 0)
                {
                    BLL.SYS.CommonBLL.ExecuteNonQueryBySql(@string.ToString());
                }
                trans.Complete();
            }
        }
Exemple #13
0
        /// <summary>
        /// 入库免检物料重新校验检验模式
        /// </summary>
        /// <param name="receiveInfo"></param>
        /// <param name="receiveDetailInfos"></param>
        /// <param name="loginUser"></param>
        /// <param name="inspectionFlag"></param>
        /// <returns></returns>
        public static string ReloadInspectionMode(ReceiveInfo receiveInfo, ref List <ReceiveDetailInfo> receiveDetailInfos, string loginUser)
        {
            ///是否启用质量系统接口
            string enableQmisFlag = new ConfigDAL().GetValueByCode("ENABLE_QMIS_FLAG");
            ///获取所有涉及的检验模式,只获取单据中免检物料
            List <PartInspectionModeInfo> partInspectionModeInfos = new PartInspectionModeDAL().GetList("" +
                                                                                                        "[PART_NO] in ('" + string.Join("','", receiveDetailInfos.Where(d => d.InspectionMode.GetValueOrDefault() == (int)InspectionModeConstants.ExemptionInspection).Select(d => d.PartNo).ToArray()) + "') and " +
                                                                                                        "[SUPPLIER_NUM] in ('" + string.Join("','", receiveDetailInfos.Select(d => d.SupplierNum).ToArray()) + "')",
                                                                                                        string.Empty);
            ///LOG_FID
            Guid          logFid  = Guid.NewGuid();
            StringBuilder @string = new StringBuilder();

            foreach (ReceiveDetailInfo receiveDetailInfo in receiveDetailInfos)
            {
                PartInspectionModeInfo partInspectionModeInfo = partInspectionModeInfos.FirstOrDefault(d => d.PartNo == receiveDetailInfo.PartNo && d.SupplierNum == receiveDetailInfo.SupplierNum);
                ///没有检验模式时如何处理,按照批检处理,TODO:增加系统配置
                if (partInspectionModeInfo == null)
                {
                    partInspectionModeInfo = new PartInspectionModeInfo();
                    partInspectionModeInfo.InspectionMode = (int)InspectionModeConstants.BatchInspection;
                }
                ///检验模式无变化时,不产生检验任务
                if (partInspectionModeInfo.InspectionMode == receiveDetailInfo.InspectionMode)
                {
                    continue;
                }
                ///将当前检验模式写入入库单明细
                receiveDetailInfo.InspectionMode = partInspectionModeInfo.InspectionMode;
                ///TODO:可以加入LES质量检验模块数据内容生成逻辑
                ///是否启用质量系统接口
                if (enableQmisFlag.ToLower() != "true")
                {
                    continue;
                }
                ///QMIS检验模式
                int qmisCheckMode = 0;
                switch (partInspectionModeInfo.InspectionMode.GetValueOrDefault())
                {
                case (int)InspectionModeConstants.SamplingInspection: qmisCheckMode = (int)QmisInspectionModeConstants.Sampling; break;

                case (int)InspectionModeConstants.BatchInspection: qmisCheckMode = (int)QmisInspectionModeConstants.Batch; break;

                default: continue;
                }
                ///
                QmisAsnPullSheetInfo qmisAsnPullSheetInfo = QmisAsnPullSheetBLL.CreateQmisAsnPullSheetInfo(loginUser);
                ///
                QmisAsnPullSheetBLL.GetQmisAsnPullSheetInfo(receiveDetailInfo, ref qmisAsnPullSheetInfo);
                ///LOG_FID,日志外键
                qmisAsnPullSheetInfo.LogFid = logFid;
                ///CHECK_MODE,检验模式
                qmisAsnPullSheetInfo.CheckMode = qmisCheckMode.ToString();
                ///TOTAL_NO,送检数量,TODO:送检数量即为实收数量?
                qmisAsnPullSheetInfo.TotalNo = Convert.ToInt32(receiveDetailInfo.ActualQty.GetValueOrDefault());
                ///
                @string.AppendLine(QmisAsnPullSheetDAL.GetInsertSql(qmisAsnPullSheetInfo));
            }
            if (@string.Length > 0)
            {
                @string.AppendLine(CommonBLL.GetCreateOutboundLogSql("QMIS", logFid, "LES-QMIS-002", receiveInfo.ReceiveNo, loginUser));
            }
            return(@string.ToString());
        }
Exemple #14
0
        public Result <PayRequest> CreateNewPaymentRequest(ReceiveInfo receiveInfo)
        {
            ApiResponse response = PaymentRequestApi.CreateNewPaymentRequest(receiveInfo.Tag, receiveInfo.Amount, receiveInfo.Comment).Result;

            return(GetResult <PayRequest>(response));
        }