예제 #1
0
        async Task HandleTCS(CreateProcessJobRequest tx)
        {
            var s16f16 = await EAP.SendAsync(new SecsMessage(16, 15, "CreateProcessJob",
                                                             Item.L(
                                                                 Item.U4(0),
                                                                 Item.L(from pj in tx.ProcessJobs select
                                                                        Item.L(
                                                                            Item.A(pj.Id),
                                                                            Item.B(2),
                                                                            Item.L(from carrier in pj.Carriers select
                                                                                   Item.L(
                                                                                       Item.A(carrier.Id),
                                                                                       Item.L(from slot in carrier.SlotMap select
                                                                                              Item.U1(slot.SlotNo)))),
                                                                            Item.L(
                                                                                Item.A("STANDARD"),
                                                                                Item.A(pj.RecipeId),
                                                                                Item.L()),
                                                                            Item.Boolean(true),
                                                                            Item.L())))));

            if (!s16f16.SecsItem.Items[1].Items[0])
            {
                throw new ScenarioException("CreateProcessJob fail. ");
            }

            foreach (var processJob in tx.ProcessJobs)
            {
                this._ProcessingJobs.Add(processJob);
            }
        }
예제 #2
0
        void EQP_DataCollectionComplete(SecsMessage msg)
        {
            var tmpList = msg.SecsItem.Items[2].Items[0].Items[1];

            var carrier_slot_port = (string)tmpList.Items[1];
            var i         = carrier_slot_port.IndexOf('.');
            var carrierId = carrier_slot_port.Substring(0, i);
            var slotNo    = Convert.ToByte(carrier_slot_port.Substring(i + 1, 2));
            var portNo    = carrier_slot_port[carrier_slot_port.Length - 1];

            var processJob = GetProcessJob(carrierId, slotNo);
            var dc         = new DataCollectionReport(processJob);
            var dcc        = new DataCollectionCompleteReport(processJob);

            try {
                dc.AddLotData("PJL0", processJob.Id);
                dc.AddLotData("CJL0", carrierId);
                dc.AddLotData("SNL0", slotNo);
                dc.AddLotData("PIL0", Convert.ToByte(portNo));
                dc.AddLotData("RIL0", tmpList.Items[2]);
                dc.AddLotData("LTL0", (uint)tmpList.Items[3] / 100);
            } finally {
                EAP.Report(dc);
                EAP.Report(dcc);
            }
        }
예제 #3
0
        async Task TCS_CreateProcessJob(CreateProcessJobRequest tx)
        {
            var s16f16 = await EAP.SendAsync(new SecsMessage(16, 15, "CreateProcessJob",
                                                             Item.L(
                                                                 Item.U4(0),
                                                                 Item.L(from pj in tx.ProcessJobs select
                                                                        Item.L(
                                                                            Item.A(pj.Id),
                                                                            Item.B(0x0D),
                                                                            Item.L(from carrier in pj.Carriers select
                                                                                   Item.L(
                                                                                       Item.A(carrier.Id),
                                                                                       Item.L(from slotInfo in carrier.SlotMap select
                                                                                              Item.U1(slotInfo.SlotNo)))),
                                                                            Item.L(
                                                                                Item.U1(1),
                                                                                Item.A(pj.RecipeId),
                                                                                Item.L()),
                                                                            Item.Boolean(true),
                                                                            Item.L())))));

            if (!s16f16.SecsItem.Items[1].Items[0])
            {
                throw new ScenarioException("CreateProcessJob fail Return Code:" + s16f16.SecsItem.Items[1].Items[0]);
            }

            foreach (var processJob in tx.ProcessJobs)
            {
                this._ProcessingJobs[processJob.Id] = processJob;
            }
        }
예제 #4
0
 void EQP_CarrierIdRead(SecsMessage msg)
 {
     EAP.Report(new CarrierIDReport {
         LoadPortId = GetPortID((byte)msg.SecsItem.Items[2].Items[0].Items[1].Items[0]),
         CarrierId  = (string)msg.SecsItem.Items[2].Items[0].Items[1].Items[1]
     });
 }
예제 #5
0
        async Task HandleTCS(CreateControlJobRequest tx)
        {
            var s14f10 = await EAP.SendAsync(new SecsMessage(14, 9, "CreaeteControlJob",
                                                             Item.L(
                                                                 Item.A("Equipment"),
                                                                 Item.A("ControlJob"),
                                                                 Item.L(
                                                                     Item.L(
                                                                         Item.A("ObjID"),
                                                                         Item.A(tx.ControlJobID)),
                                                                     Item.L(
                                                                         Item.A("CarrierInputSpec"),
                                                                         Item.L(from carrier in tx.CarrierIDs select
                                                                                Item.A(carrier))),
                                                                     Item.L(
                                                                         Item.A("ProcessingCtrlSpec"),
                                                                         Item.L(from pj in tx.ProcessJobIDs select
                                                                                Item.L(
                                                                                    Item.A(pj),
                                                                                    Item.L(),
                                                                                    Item.A()))),
                                                                     Item.L(
                                                                         Item.A("ProcessOrderMgmt"),
                                                                         Item.U1(0)),
                                                                     Item.L(
                                                                         Item.A("StartMethod"),
                                                                         Item.Boolean(true))))));

            byte returnCode = (byte)s14f10.SecsItem.Items[2].Items[0];

            if (returnCode != 0 && returnCode != 4)
            {
                throw new ScenarioException("CreateControlJob fail. ");
            }
        }
예제 #6
0
        protected override void Init()
        {
            // TX handler
            EAP.SetTxHandler <ToolModeChangeRequest>(HandleTCS);
            EAP.SetTxHandler <AccessModeChangeRequest>(HandleTCS);
            EAP.SetTxHandler <AskLoadStatusRequest>(HandleTCS);
            EAP.SetTxHandler <ProceedWithCarrierRequest>(HandleTCS);
            EAP.SetTxHandler <ProceedSlotMapRequest>(HandleTCS);
            EAP.SetTxHandler <CancelCarrierRequest>(HandleTCS);
            EAP.SetTxHandler <CreateProcessJobRequest>(HandleTCS);
            EAP.SetTxHandler <CreateControlJobRequest>(HandleTCS);
            EAP.SetTxHandler <ControlJobsInfoInqueryAck>(HandleTCS);

            // SecsMessage handler
            EAP.SubscribeS6F11("LoadComplete", EQP_LoadComplete);
            EAP.SubscribeS6F11("ReadyToLoad", EQP_ReadyToLoad);
            EAP.SubscribeS6F11("ReadyToUnload", EQP_ReadyToUnload);
            EAP.SubscribeS6F11("UnloadComplete", EQP_UnloadComplete);
            EAP.SubscribeS6F11("CarrierIDRead", EQP_CarrierIdRead);
            EAP.SubscribeS6F11("CarrierIDReadFail", EQP_CarrierIdReadFail);
            EAP.SubscribeS6F11("SlotMapReport", EQP_SlotMapReport);
            EAP.SubscribeS6F11("ControlJobStart", EQP_ControlJobStart);
            EAP.SubscribeS6F11("ControlJobEnd", EQP_ControlJobEnd);
            EAP.SubscribeS6F11("ProcessJobStart", EQP_ProcessJobStart);
            EAP.SubscribeS6F11("ProcessJobEnd", EQP_ProcessJobEnd);
            EAP.SubscribeS6F11("WaferProcessData", EQP_DataCollection);
            EAP.SubscribeS6F11("WaferStatusChange", EQP_WaferStatusChange);
            EAP.SubscribeS6F11("DataCollectionComplete", EQP_DataCollectionComplete);
        }
예제 #7
0
        protected override void Init()
        {
            // TX Handler
            EAP.SetTxHandler <ToolModeChangeRequest>(TCS_ToolModeChange);
            EAP.SetTxHandler <AccessModeChangeRequest>(TCS_AccessModeChange);
            EAP.SetTxHandler <AskLoadStatusRequest>(TCS_AskLoadtStatus);
            EAP.SetTxHandler <CreateProcessJobRequest>(TCS_CreateProcessJob);
            EAP.SetTxHandler <CreateControlJobRequest>(TCS_CreateControlJob);
            EAP.SetTxHandler <ProceedWithCarrierRequest>(TCS_ProceedWithCarrier);
            EAP.SetTxHandler <ProceedSlotMapRequest>(TCS_ProceedSlotMap);
            EAP.SetTxHandler <CancelCarrierRequest>(TCS_CancelCarrier);
            EAP.SetTxHandler <ControlJobsInfoInqueryAck>(TCS_ControlJobsInfoInqueryAck);

            // SecsMessage Handler
            EAP.SubscribeS6F11("LoadComplete", EQP_LoadComplete);
            EAP.SubscribeS6F11("ReadyToLoad", EQP_ReadyToLoad);
            EAP.SubscribeS6F11("ReadyToUnload", EQP_ReadyToUnload);
            EAP.SubscribeS6F11("UnloadComplete", EQP_UnloadComplete);
            EAP.SubscribeS6F11("CarrierIDRead", EQP_CarrierIDRead);
            EAP.SubscribeS6F11("CarrierIDReadFail", EQP_CarrierIDReadFail);
            EAP.SubscribeS6F11("SlotMapReport", EQP_SlotMapReport);
            EAP.SubscribeS6F11("ControlJobStart", EQP_ControlJobStart);
            EAP.SubscribeS6F11("ControlJobEnd", EQP_ControlJobEnd);
            EAP.SubscribeS6F11("ProcessJobStart", EQP_ProcessJobStart);
            EAP.SubscribeS6F11("ProcessJobEnd", EQP_ProcessJobEnd);
            EAP.SubscribeS6F11("WaferProcessData_LLH", EQP_WaferProcessData_LLH_LHC);
            EAP.SubscribeS6F11("WaferProcessData_LHC", EQP_WaferProcessData_LLH_LHC);
            EAP.SubscribeS6F11("WaferProcessData_PVD", EQP_WaferProcessData_PVD);
        }
예제 #8
0
        void EQP_WaferStatusChange(SecsMessage msg)
        {
            Item   dataList = msg.SecsItem.Items[2].Items[0].Items[1];
            string pjId     = dataList.Items[0].GetValue <string>();

            string carrier_slot_port = (string)dataList.Items[1];
            int    i         = carrier_slot_port.IndexOf('.');
            string carrierId = carrier_slot_port.Substring(0, i);
            byte   slotNo    = Convert.ToByte(carrier_slot_port.Substring(i + 1, 2));

            string state = dataList.Items[2].GetValue <string>();

            switch (state)
            {
            case "SubstLocChamber":
                EAP.Report(new WaferStartReport {
                    ProcessJobId = GetProcessJob(carrierId, slotNo).Id,
                    CarrierId    = carrierId,
                    SlotNo       = slotNo
                });
                break;

            case "SubstLocLowerArm":
                EAP.Report(new WaferEndReport {
                    ProcessJobId = GetProcessJob(carrierId, slotNo).Id,
                    CarrierId    = carrierId,
                    SlotNo       = slotNo
                });
                break;
            }
        }
예제 #9
0
        void EQP_CarrierIDReadFail(SecsMessage msg)
        {
            byte portNo = (byte)msg.SecsItem.Items[2].Items[0].Items[1].Items[0];

            EAP.Report(new CarrierIDReport {
                LoadPortId = GetPortID(portNo)
            });
        }
예제 #10
0
        async Task CommunicationTest()
        {
            var s1f14 = await EAP.SendAsync(EAP.SecsMessages[1, 13, "EstablishCommunicationsRequest_Host"]);

            if ((byte)s1f14.SecsItem.Items[0] != 0)
            {
                throw new ScenarioException("S1F14 return code is not 0");
            }
        }
예제 #11
0
        private static void DemonstrateEventBasedAsynchronousPattern()
        {
            EAP eap = new EAP();

            eap.WorkDoneHandler += ProcessEAPResult;
            eap.DoWorkAsync();

            Console.WriteLine("Demonstration of Event-based Asynchronous Pattern is started...");
        }
예제 #12
0
        void EQP_ProcessJobEnd(SecsMessage msg)
        {
            string id = msg.SecsItem.Items[2].Items[0].Items[1].Items[0].GetString().Trim();

            EAP.Report(new ProcessJobEndReport {
                ProcessJobID = id
            });
            EAP.Report(new DataCollectionCompleteReport(GetProcessJob(id)));
        }
예제 #13
0
 public virtual async Task DefineLink()
 {
     DefineLinkSuccess(await EAP.SendAsync(S2F37_DisableEvent));
     DefineLinkSuccess(await EAP.SendAsync(S2F35_DisableEventReportLink));
     DefineLinkSuccess(await EAP.SendAsync(S2F33_DisableReport));
     DefineLinkSuccess(await EAP.SendAsync(S2F33_DefineReport));
     DefineLinkSuccess(await EAP.SendAsync(S2F35_DefineEventReportLink));
     DefineLinkSuccess(await EAP.SendAsync(S2F37_EnableEvent));
 }
예제 #14
0
        async Task QueryControlState()
        {
            var s1f4 = await EAP.SendAsync(EAP.SecsMessages[1, 3, "QueryOnlineSubStatus"]);

            if ((ushort)s1f4.SecsItem.Items[0] != 5)
            {
                throw new ScenarioException("S1F4_ControlState return code is " + s1f4.SecsItem.Items[0] + ", not Online/Remote mode");
            }
        }
예제 #15
0
        async Task CheckPJSpace()
        {
            var s16f22 = await EAP.SendAsync(EAP.SecsMessages[16, 21, "GetPJSpace"]);

            if ((ushort)s16f22.SecsItem == 0)
            {
                throw new ScenarioException("ProcessJob Space is 0");
            }
        }
예제 #16
0
        async Task CheckCJSpace()
        {
            var s1f4 = await EAP.SendAsync(EAP.SecsMessages[1, 3, "GetCJSpace"]);

            if ((byte)s1f4.SecsItem.Items[0] == 0)
            {
                throw new ScenarioException("ControlJob Space is 0");
            }
        }
예제 #17
0
        void EQP_CarrierIDRead(SecsMessage msg)
        {
            var portNo    = (byte)msg.SecsItem.Items[2].Items[0].Items[1].Items[0];
            var carrierId = msg.SecsItem.Items[2].Items[0].Items[1].Items[1].GetString().Trim();

            EAP.Report(new CarrierIDReport {
                LoadPortId = GetPortID(portNo),
                CarrierId  = carrierId
            });
        }
예제 #18
0
        void EQP_CarrierIDRead(SecsMessage msg)
        {
            byte   portNo    = (byte)msg.SecsItem.Items[2].Items[0].Items[1].Items[0];
            string carrierID = msg.SecsItem.Items[2].Items[0].Items[1].Items[1].GetValue <string>().Trim();

            EAP.Report(new CarrierIDReport {
                LoadPortId = GetPortID(portNo),
                CarrierId  = carrierID
            });
        }
예제 #19
0
        async void EQP_LoadComplete(SecsMessage msg)
        {
            byte   portNo = (byte)msg.SecsItem.Items[2].Items[0].Items[1].Items[0];
            string portId = GetPortID(portNo);

            EAP.Report(new LoadCompReport {
                PortID = portId
            });

            // Wait CarrierIDRead Event 10 sec.
            {
                // Method 1:
                //ThreadPool.QueueUserWorkItem(delegate {
                //    EapLogger.Notice(portId + " StartAsync CarrierIDRead Timer");
                //    using (var ev = new ManualResetEvent(false)) {
                //        var callback = new Action<SecsMessage>(secsMsg => {
                //            if (portNo == (byte)secsMsg.SecsItem.Items[2].Items[0].Items[1].Items[0])
                //                ev.Set();
                //        });
                //        using (EAP.SubscribeS6F11("CarrierIDRead", callback))
                //        using (EAP.SubscribeS6F11("CarrierIDReadFail", callback)) {
                //            if (!ev.WaitOne(10000)) {
                //                EapLogger.Error(portId + " CarrierIDRead Timeout!!");
                //                EAP.Report(new CarrierIDReport {
                //                    LoadPortId = portId
                //                });
                //            }
                //        }
                //    }
                //});
            }
            {
                // Method 2:
                //EapLogger.Notice(portId + " StartAsync CarrierIDRead Timer");
                //var ev = new ManualResetEvent(false);
                //var callback = new Action<SecsMessage>(secsMsg => {
                //    if (portNo == (byte)secsMsg.SecsItem.Items[2].Items[0].Items[1].Items[0])
                //        ev.Set();
                //});
                //var read = EAP.SubscribeS6F11("CarrierIDRead", callback);
                //var readfail = EAP.SubscribeS6F11("CarrierIDReadFail", callback);
                //ThreadPool.RegisterWaitForSingleObject(ev, (state, timeout) => {
                //    if (read != null)
                //        read.Dispose();
                //    if (readfail != null)
                //        readfail.Dispose();
                //    if (timeout) {
                //        EapLogger.Error(portId + " CarrierIDRead Timeout!!");
                //        EAP.Report(new CarrierIDReport {
                //            LoadPortId = portId
                //        });
                //    }
                //}, null, 10000, true);
            }
        }
예제 #20
0
        async Task RequestOnline()
        {
            var s1f18 = await EAP.SendAsync(EAP.SecsMessages[1, 17, "RequestOnLine"]);

            byte returnCode = (byte)s1f18.SecsItem;

            if (returnCode != 0 && returnCode != 2)
            {
                throw new ScenarioException("S1F18 return code is " + returnCode);
            }
        }
예제 #21
0
        void EQP_UnloadComplete(SecsMessage msg)
        {
            var portId = GetPortID((byte)msg.SecsItem.Items[2].Items[0].Items[1].Items[0]);

            EAP.Report(new UnloadCompleteReport {
                PortID = portId
            });

            //清除相關Loadport上的ProcessJob物件
            _ProcessingJobs.RemoveAll(pj => pj.Carriers.First().LoadPortId == portId);
        }
예제 #22
0
        void EQP_SlotMapReport(SecsMessage msg)
        {
            var portNo    = (byte)msg.SecsItem.Items[2].Items[0].Items[1].Items[0];
            var carrierId = (string)msg.SecsItem.Items[2].Items[0].Items[1].Items[1];
            var map       = (string)msg.SecsItem.Items[2].Items[0].Items[1].Items[1 + portNo];

            EAP.Report(new SlotMapReport {
                LoadPortID = GetPortID(portNo),
                CarrierID  = carrierId,
                Slots      = from i in Enumerable.Range(0, map.Length)
                             where map[i] == '1'
                             select(byte)(i + 1)
            });
        }
예제 #23
0
        void EQP_SlotMapReport(SecsMessage msg)
        {
            byte   portNo    = (byte)msg.SecsItem.Items[2].Items[0].Items[1].Items[0];
            string carrierID = msg.SecsItem.Items[2].Items[0].Items[1].Items[1].GetValue <string>().Trim();
            var    mapItem   = msg.SecsItem.Items[2].Items[0].Items[1].Items[2].Items;

            EAP.Report(new SlotMapReport {
                LoadPortID = GetPortID(portNo),
                CarrierID  = carrierID,
                Slots      = from i in Enumerable.Range(0, mapItem.Count)
                             where mapItem[i].GetValue <byte>() == 4
                             select(byte)(i + 1)
            });
        }
예제 #24
0
        async Task CheckRecipe(AskLoadStatusRequest tx)
        {
            var s7f20 = await EAP.SendAsync(EAP.SecsMessages[7, 19, "GetRecipeList"]);

            var recipeList = from item in s7f20.SecsItem.Items
                             select(string) item;

            foreach (var pj in tx.ProcessJobs)
            {
                if (!recipeList.Any(ppid => ppid == pj.RecipeId))
                {
                    throw new ScenarioException("PPID(\'" + pj.RecipeId + "\') Not Found.");
                }
            }
        }
예제 #25
0
 async Task DeleteProcessJob(IEnumerable <string> processJobIds)
 {
     foreach (string pjID in processJobIds)
     {
         _ProcessingJobs.Remove(pjID);
         try {
             await EAP.SendAsync(new SecsMessage(16, 5, "PJCancel",
                                                 Item.L(
                                                     Item.U4(0),
                                                     Item.A(pjID),
                                                     Item.A("Cancel"),
                                                     Item.L())));
         } catch { }
     }
 }
예제 #26
0
        async Task CheckPJDuplicated(AskLoadStatusRequest tx)
        {
            var s16f20 = await EAP.SendAsync(EAP.SecsMessages[16, 19, "GetAllPJ"]);

            foreach (var pj in tx.ProcessJobs)
            {
                foreach (var item in s16f20.SecsItem.Items)
                {
                    if ((string)item.Items[0] == pj.Id)
                    {
                        throw new ScenarioException("CheckPJDuplicated Error: ProcessJobID(\'" + pj.Id + "\') is exist!");
                    }
                }
            }
        }
예제 #27
0
        async Task QueryAndChangeAccessMode(IEnumerable <LoadPort> requestLoadPorts)
        {
            var s1f4 = await EAP.SendAsync(EAP.SecsMessages[1, 3, "QueryLoadPortAccessMode"]);

            foreach (LoadPort port in requestLoadPorts)
            {
                byte portNo = GetPortNo(port.Id);
                // 0: Manual
                // 1: Auto
                if ((byte)s1f4.SecsItem.Items[portNo - 1] != (byte)port.AccessMode)
                {
                    await ChangeAccessMode(port.AccessMode, portNo);
                }
            }
        }
예제 #28
0
        void EQP_WaferProcessData_PVD(SecsMessage msg)
        {
            Item   tempList = msg.SecsItem.Items[2].Items[0].Items[1].Items[0];
            string pjID     = tempList.Items[1].GetValue <string>();
            byte   slotNo   = (byte)tempList.Items[4].Items[0].Items[1];

            tempList = tempList.Items[4].Items[0].Items[2].Items[0];
            string chamber = tempList.Items[0].Items[1].GetValue <string>();

            var dc = new DataCollectionReport(GetProcessJob(pjID));

            try {
                dc.AddLotData("CIWW", chamber);
            } finally {
                EAP.Report(dc);
            }
        }
예제 #29
0
        async Task HandleTCS(ProceedSlotMapRequest tx)
        {
            var s3f18 = await EAP.SendAsync(new SecsMessage(3, 17, "ProceedWithCarrier",
                                                            Item.L(
                                                                Item.U4(2),
                                                                Item.A("ProceedWithCarrier"),
                                                                Item.A(tx.Carrier.Id),
                                                                Item.U1(GetPortNo(tx.Carrier.LoadPortId)),
                                                                Item.L())));

            byte returnCode = (byte)s3f18.SecsItem.Items[0];

            if (returnCode != 0 && returnCode != 4)
            {
                throw new ScenarioException("ProceedWithCarrier failed. ");
            }
        }
예제 #30
0
        public EAP GetEAP(string raiz)
        {
            var eap = new EAP();


            var pastas = _repositorioIO.GetPastas(raiz);

            foreach (var pasta in pastas)
            {
                var area = new Area(pasta);
                eap.AdicionaArea(area);
                AddArea(area);
            }


            return(eap);
        }
예제 #31
0
파일: Order.cs 프로젝트: honj51/EAP
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tenantID"></param>
        /// <param name="userID"></param>
        /// <param name="oStatus">用户指定的状态</param>
        /// <param name="paidAmount">支付金额</param>
        /// <param name="bankID">银行</param>
        /// <param name="db"></param>
        /// <returns></returns>
        public bool Pay(Guid tenantID, Guid userID, EAP.Logic.Z10.OrderStatus oStatus, decimal paidAmount, long? bankID)
        {
            int orderSts = Z10Order.OrderStatus ?? 0;
            if ((orderSts & (int)EAP.Logic.Z10.OrderStatus.Paid) == (int)EAP.Logic.Z10.OrderStatus.Paid ||
                (orderSts & (int)EAP.Logic.Z10.OrderStatus.Finished) == (int)EAP.Logic.Z10.OrderStatus.Finished ||
                (orderSts & (int)EAP.Logic.Z10.OrderStatus.Archived) == (int)EAP.Logic.Z10.OrderStatus.Archived)
            {
                throw new Exception("已经支付的订单,已经结束的订单和已经存档的订单不能支付。");
            }

            Zippy.Data.IDalProvider db = Zippy.Data.StaticDB.DB;

            Z10Order xorder = new Z10Order();
            xorder.OrderID = Z10Order.OrderID;
            xorder.FeePaid = Z10Order.FeePaid + paidAmount;

            if (oStatus == OrderStatus.Paid)
            {
                xorder.OrderStatus = orderSts & ~(int)OrderStatus.PaidSome;
                xorder.OrderStatus = (xorder.OrderStatus ?? 0) | (int)oStatus;
            }
            else
            {
                //throw new Exception(orderSts.ToString() + "  -- " + oStatus + " -- " + ((Z10Order.OrderStatus ?? 0) | (int)oStatus));
                xorder.OrderStatus = orderSts | (int)oStatus;
            }

            db.Update(xorder);

            Z01Beetle.Entity.Z01FinancialFlow dflow = new Z01Beetle.Entity.Z01FinancialFlow();

            dflow.FlowID = null;
            dflow.OrderID = Z10Order.OrderID;
            dflow.Amount = paidAmount;
            dflow.Creator = userID;
            dflow.TenantID = tenantID;
            dflow.BankID = bankID;
            dflow.Currency = Z10Order.Currency;
            db.Insert(dflow);

            //string sqlUpdateStatus = "update Z10Order set OrderStatus=OrderStatus|@paid where OrderID=@orderid ";
            //Zippy.Data.StaticDB.DB.ExecuteNonQuery(sqlUpdateStatus,
            //    Zippy.Data.StaticDB.DB.CreateParameter("paid", (int)EAP.Logic.Z10.OrderStatus.Paid),
            //    Zippy.Data.StaticDB.DB.CreateParameter("orderid", Z10Order.OrderID ?? 0));

            return true;
        }
예제 #32
0
파일: Order.cs 프로젝트: honj51/EAP
 /// <summary>
 /// 将整个订单入库(完成整个订单)
 /// </summary>
 /// <param name="tenantID">租户</param>
 /// <param name="userID">操作者</param>
 /// <param name="order">订单</param>
 /// <returns></returns>
 public bool PutIn(Guid tenantID, Guid userID, EAP.Logic.Z10.Order order)
 {
     return false;
 }
예제 #33
0
파일: Order.cs 프로젝트: honj51/EAP
        /// <summary>
        /// 采购出入库
        /// </summary>
        /// <param name="tenantID">租户</param>
        /// <param name="userID">操作者</param>
        /// <param name="oStatus">当前状态</param>
        /// <param name="hsItemCount">各个商品的具体入库数量</param>
        /// <param name="db"></param>
        /// <returns></returns>
        public bool InOutDepot(Guid tenantID, Guid userID, EAP.Logic.Z10.OrderStatus oStatus, Hashtable hsItemCount, Zippy.Data.IDalProvider db)
        {
            throw new Exception("这个入库方式需要商榷。");
            int orderSts = Z10Order.OrderStatus ?? 0;
            if ((orderSts & (int)EAP.Logic.Z10.OrderStatus.Outted) == (int)EAP.Logic.Z10.OrderStatus.Inned ||
                (orderSts & (int)EAP.Logic.Z10.OrderStatus.Finished) == (int)EAP.Logic.Z10.OrderStatus.Finished ||
                (orderSts & (int)EAP.Logic.Z10.OrderStatus.Archived) == (int)EAP.Logic.Z10.OrderStatus.Archived)
            {
                throw new Exception("已经出入库的订单,已经结束的订单和已经存档的订单不能出入库。");
            }

            Z10Order xorder = new Z10Order();
            xorder.OrderID = Z10Order.OrderID;

            if (oStatus == OrderStatus.Inned && ((Z10Order.OrderStatus ?? 0) & (int)OrderStatus.InnedSome) == (int)OrderStatus.InnedSome)
            {
                oStatus = oStatus & (~OrderStatus.InnedSome);
                xorder.OrderStatus = (Z10Order.OrderStatus ?? 0) & (~(int)OrderStatus.InnedSome);
                xorder.OrderStatus = (xorder.OrderStatus ?? 0) | (int)oStatus;
            }
            else if (oStatus == OrderStatus.Outted && ((Z10Order.OrderStatus ?? 0) & (int)OrderStatus.OuttedSome) == (int)OrderStatus.OuttedSome)
            {
                oStatus = oStatus & (~OrderStatus.OuttedSome);
                xorder.OrderStatus = (Z10Order.OrderStatus ?? 0) & (~(int)OrderStatus.OuttedSome);
                xorder.OrderStatus = (xorder.OrderStatus ?? 0) | (int)oStatus;
            }
            else
            {
                xorder.OrderStatus = (Z10Order.OrderStatus ?? 0) | (int)oStatus;
            }

            db.Update(xorder);

            Z10DepotFlow dflow = new Z10DepotFlow();
            foreach (Z10OrderItem item in Items)
            {
                decimal itemHappened = hsItemCount[item.ItemID].ToDecimal();

                if ((oStatus & OrderStatus.Outted) == OrderStatus.Outted || (oStatus & OrderStatus.OuttedSome) == OrderStatus.OuttedSome)
                    db.ColAdd<Z10OrderItem>("CountHappend2", itemHappened, item.ItemID);
                else
                    db.ColAdd<Z10OrderItem>("CountHappend", itemHappened, item.ItemID);

                if (item.CountHappend != 0 || item.CountHappend2 != 0)
                {
                    dflow.FlowID = null;
                    dflow.OrderID = Z10Order.OrderID;
                    dflow.Count = itemHappened;
                    dflow.DepotID = item.DepotID;
                    dflow.Creator = userID;
                    dflow.ProductID = item.ProductID;
                    dflow.TenantID = tenantID;
                    db.Insert(dflow);

                    if (!db.Exists<Z10DepotProduct>("ProductID=@ProductID and DepotID=@DepotID and TenantID=@TenantID",
                        db.CreateParameter("ProductID", item.ProductID), db.CreateParameter("DepotID", item.DepotID), db.CreateParameter("TenantID", tenantID)))
                    {
                        Z10DepotProduct xProduct = new Z10DepotProduct();
                        xProduct.TenantID = tenantID;
                        xProduct.ProductID = item.ProductID;
                        xProduct.DepotID = item.DepotID;
                        xProduct.StockSum = itemHappened;
                        db.Insert(xProduct);
                    }
                    else
                    {
                        string sqlUpdateDepot = "update Z10DepotProduct set StockSum=StockSum + @itemHappened, InSum=InSum + @itemHappened" +
                            " where ProductID=@ProductID and DepotID=@DepotID";
                        db.ExecuteNonQuery(sqlUpdateDepot, db.CreateParameter("itemHappened", itemHappened),
                            db.CreateParameter("ProductID", item.ProductID), db.CreateParameter("DepotID", item.DepotID));

                    }
                }
            }
            return true;
        }