public virtual void UpdateScmsWorkOrder(ScmsWorkOrderNewKQ entity)
 {
     entityDao.Update(entity);
 }
 public virtual void DeleteScmsWorkOrder(ScmsWorkOrderNewKQ entity)
 {
     entityDao.Delete(entity);
 }
Пример #3
0
        //[Transaction(TransactionMode.Requires)]
        private void ProcessOrderDetailOut(ScmsTableIndex scmsTableIndex)
        {
            IList <OrderDetail> orderDetailList = GetTransferOrderDetail();

            if (orderDetailList != null && orderDetailList.Count > 0)
            {
                foreach (OrderDetail orderDetail in orderDetailList)
                {
                    try
                    {
                        ScmsWorkOrder      workOrder = scmsWorkOrderMgr.LoadScmsWorkOrder(orderDetail.OrderHead.OrderNo, orderDetail.Item.Code);
                        ScmsWorkOrderNew   newwo     = scmsWorkOrderNewMgr.LoadScmsWorkOrder(orderDetail.OrderHead.OrderNo, orderDetail.Item.Code);
                        ScmsWorkOrderNewKQ kqwo      = scmsWorkOrderNewKQMgr.LoadScmsWorkOrder(orderDetail.OrderHead.OrderNo, orderDetail.Item.Code);
                        if (orderDetail.OrderHead.SubType != "Rwo")//返工工单不许传递  djin 2012-4-28
                        {
                            if (workOrder == null)
                            {
                                #region SCMS_WO
                                workOrder                = new ScmsWorkOrder();
                                workOrder.Bom            = orderDetail.Bom != null ? orderDetail.Bom.Code : orderDetail.Item.Code;
                                workOrder.Flag           = MesDssConstants.SCMS_MES_FLAG_SCMS_UPDATED;
                                workOrder.IsAdditional   = orderDetail.OrderHead.IsAdditional ? "1" : "0";
                                workOrder.ItemCode       = orderDetail.Item.Code;
                                workOrder.LastModifyDate = orderDetail.OrderHead.LastModifyDate;
                                workOrder.LastModifyUser = orderDetail.OrderHead.LastModifyUser.Code;
                                workOrder.OrderNo        = orderDetail.OrderHead.OrderNo;
                                workOrder.ProductLine    = flowMgr.LoadFlow(orderDetail.OrderHead.Flow).Description;
                                workOrder.Qty            = Convert.ToInt32(orderDetail.OrderedQty);
                                workOrder.RefItemCode    = orderDetail.ReferenceItemCode;
                                workOrder.RefOrderNo     = orderDetail.OrderHead.ReferenceOrderNo;
                                workOrder.Shift          = orderDetail.OrderHead.Shift.ShiftName;
                                workOrder.StartTime      = orderDetail.OrderHead.StartTime;
                                workOrder.UC             = Convert.ToInt32(orderDetail.UnitCount);
                                //workOrder.Version = orderDetail.ItemVersion;
                                workOrder.WindowTime = orderDetail.OrderHead.WindowTime;
                                workOrder.ShiftCode  = orderDetail.OrderHead.Shift.Code;
                                scmsWorkOrderMgr.CreateScmsWorkOrder(workOrder);
                                #endregion
                            }

                            if (newwo == null)
                            {
                                #region scms_wo_new
                                newwo                = new ScmsWorkOrderNew();
                                newwo.Bom            = orderDetail.Bom.Code;
                                newwo.Flag           = MesDssConstants.SCMS_MES_FLAG_SCMS_UPDATED;
                                newwo.IsAdditional   = orderDetail.OrderHead.IsAdditional ? "1" : "0";
                                newwo.ItemCode       = orderDetail.Item.Code;
                                newwo.LastModifyDate = orderDetail.OrderHead.LastModifyDate;
                                newwo.LastModifyUser = orderDetail.OrderHead.LastModifyUser.Code;
                                newwo.OrderNo        = orderDetail.OrderHead.OrderNo;
                                newwo.ProductLine    = flowMgr.LoadFlow(orderDetail.OrderHead.Flow).Description;
                                newwo.Qty            = Convert.ToInt32(orderDetail.OrderedQty);
                                newwo.RefItemCode    = orderDetail.ReferenceItemCode;
                                newwo.RefOrderNo     = orderDetail.OrderHead.ReferenceOrderNo;
                                newwo.Shift          = orderDetail.OrderHead.Shift.ShiftName;
                                newwo.StartTime      = orderDetail.OrderHead.StartTime;
                                newwo.UC             = Convert.ToInt32(orderDetail.UnitCount);
                                //workOrder.Version = orderDetail.ItemVersion;
                                newwo.WindowTime = orderDetail.OrderHead.WindowTime;
                                newwo.ShiftCode  = orderDetail.OrderHead.Shift.Code;
                                scmsWorkOrderNewMgr.CreateScmsWorkOrder(newwo);

                                #endregion
                            }


                            if (kqwo == null)
                            {
                                #region scms_wo_kq
                                kqwo                = new ScmsWorkOrderNewKQ();
                                kqwo.Bom            = orderDetail.Bom.Code;
                                kqwo.Flag           = MesDssConstants.SCMS_MES_FLAG_SCMS_UPDATED;
                                kqwo.IsAdditional   = orderDetail.OrderHead.IsAdditional ? "1" : "0";
                                kqwo.ItemCode       = orderDetail.Item.Code;
                                kqwo.LastModifyDate = orderDetail.OrderHead.LastModifyDate;
                                kqwo.LastModifyUser = orderDetail.OrderHead.LastModifyUser.Code;
                                kqwo.OrderNo        = orderDetail.OrderHead.OrderNo;
                                kqwo.ProductLine    = flowMgr.LoadFlow(orderDetail.OrderHead.Flow).Description;
                                kqwo.Qty            = Convert.ToInt32(orderDetail.OrderedQty);
                                kqwo.RefItemCode    = orderDetail.ReferenceItemCode;
                                kqwo.RefOrderNo     = orderDetail.OrderHead.ReferenceOrderNo;
                                kqwo.Shift          = orderDetail.OrderHead.Shift.ShiftName;
                                kqwo.StartTime      = orderDetail.OrderHead.StartTime;
                                kqwo.UC             = Convert.ToInt32(orderDetail.UnitCount);
                                //workOrder.Version = orderDetail.ItemVersion;
                                kqwo.WindowTime = orderDetail.OrderHead.WindowTime;
                                kqwo.ShiftCode  = orderDetail.OrderHead.Shift.Code;
                                scmsWorkOrderNewKQMgr.CreateScmsWorkOrder(kqwo);
                                #endregion
                            }

                            orderDetail.TransferFlag = false;
                            orderDetailMgr.UpdateOrderDetail(orderDetail);
                        }
                    }
                    catch (Exception e)
                    {
                        log.Error(orderDetail.OrderHead.OrderNo + "," + orderDetail.Item.Code + " create exception", e);
                        continue;
                    }
                }
            }
            ScmsTableIndex newTable = scmsTableIndexMgr.LoadScmsTableIndex("SCMS_WO_NEW");
            if (newTable != null)
            {
                scmsTableIndexMgr.Complete(newTable);
            }

            ScmsTableIndex kqTable = scmsTableIndexMgr.LoadScmsTableIndex("SCMS_WO_TOSH");
            if (kqTable != null)
            {
                scmsTableIndexMgr.Complete(kqTable);
            }
            scmsTableIndexMgr.Complete(scmsTableIndex);
        }