Пример #1
0
        public static Transformer ConvertMaterialInToTransformer(MaterialIn materialIn)
        {
            if (materialIn == null)
            {
                return null;
            }

            Transformer transformer = new Transformer();
            transformer.Operation = materialIn.Operation.HasValue ? materialIn.Operation.Value : 0;
            transformer.ItemCode = materialIn.RawMaterial.Code;
            transformer.ItemDescription = materialIn.RawMaterial.Description;
            transformer.UomCode = materialIn.RawMaterial.Uom.Code;
            transformer.UnitCount = materialIn.RawMaterial.UnitCount;
            transformer.Qty = 0M;
            transformer.CurrentQty = 0M;
            transformer.LocationCode = materialIn.Location == null ? string.Empty : materialIn.Location.Code;

            return transformer;
        }
Пример #2
0
 public IList<MaterialIn> ConvertTransformersToMaterialIns(List<Transformer> transformerList)
 {
     IList<MaterialIn> materialInList = new List<MaterialIn>();
     if (transformerList != null)
     {
         foreach (Transformer transformer in transformerList)
         {
             //如果是扫描Hu的
             if (transformer.TransformerDetails != null && transformer.TransformerDetails.Count > 0)
             {
                 foreach (TransformerDetail transformerDetail in transformer.TransformerDetails)
                 {
                     MaterialIn materialIn = new MaterialIn();
                     materialIn.HuId = transformerDetail.HuId;
                     materialIn.RawMaterial = itemMgr.LoadItem(transformerDetail.ItemCode);
                     materialIn.Location = locationMgr.LoadLocation(transformerDetail.LocationCode);
                     materialIn.LotNo = transformerDetail.LotNo;
                     materialIn.Operation = transformerDetail.Operation;
                     materialIn.Qty = transformerDetail.CurrentQty;
                     materialInList.Add(materialIn);
                 }
             }
             //如果是直接输入数量的
             else
             {
                 MaterialIn materialIn = new MaterialIn();
                 materialIn.RawMaterial = itemMgr.LoadItem(transformer.ItemCode);
                 materialIn.Location = locationMgr.LoadLocation(transformer.LocationCode);
                 materialIn.Operation = transformer.Operation;
                 materialIn.Qty = transformer.CurrentQty;
                 materialInList.Add(materialIn);
             }
         }
     }
     return materialInList;
 }
Пример #3
0
        public IList<InventoryTransaction> InventoryOut(MaterialIn materialIn, User user, Flow ProductLine)
        {
            Hu hu = null;
            LocationLotDetail huLocationLotDetail = null;
            if (materialIn.HuId != null && materialIn.HuId.Trim() != string.Empty)
            {
                hu = this.huMgr.CheckAndLoadHu(materialIn.HuId);
                IList<LocationLotDetail> locationLotDetailList = this.locationLotDetailMgr.GetHuLocationLotDetail(materialIn.Location.Code, materialIn.HuId);
                if (locationLotDetailList != null && locationLotDetailList.Count > 0)
                {
                    huLocationLotDetail = locationLotDetailList[0];

                    #region �ж��Ƿ���Ҫ�¼�
                    if (huLocationLotDetail.StorageBin != null)
                    {
                        //�¼�
                        this.InventoryPick(huLocationLotDetail, user);
                    }
                    #endregion
                }
                else
                {
                    throw new BusinessErrorException("Hu.Error.NoInventory", hu.HuId);
                }
            }

            #region ���¿��
            IList<InventoryTransaction> inventoryTransactionList = RecordInventory(
                materialIn.RawMaterial,
                huLocationLotDetail != null ? huLocationLotDetail.Location : materialIn.Location,
                hu != null ? hu.HuId : null,
                hu != null ? hu.LotNo : null,
                0 - materialIn.Qty,
                false,
                null,
                BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_TR,
                null,
                //true,
                user,
                false,
                false,
                null
                );
            #endregion

            #region ��������״̬��Ͷ��Ҳ����;
            if (hu != null && materialIn.Qty > 0)
            {
                hu.Location = null;
                hu.Status = BusinessConstants.CODE_MASTER_HU_STATUS_VALUE_INPROCESS;
                this.huMgr.UpdateHu(hu);
            }
            #endregion

            #region ��¼�������
            foreach (InventoryTransaction inventoryTransaction in inventoryTransactionList)
            {
                this.locationTransactionMgr.RecordLocationTransaction(inventoryTransaction, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_MATERIAL_IN, user, null, null, ProductLine);
            }
            #endregion

            return inventoryTransactionList;
        }
Пример #4
0
        public void SetMateria(Resolver resolver)
        {
            //将已投料和新投料合并
            #region 已投料
            IList<ProductLineInProcessLocationDetail> productLineIpList =
                productLineInProcessLocationDetailMgr.GetProductLineInProcessLocationDetail(resolver.Code, BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE);
            #endregion

            #region 新投料
            //todo 根据flow得到Material的list
            IList<BomDetail> bomDetailList = flowMgr.GetBatchFeedBomDetail(resolver.Code);
            IList<MaterialIn> materialInList = new List<MaterialIn>();
            Flow flow = flowMgr.LoadFlow(resolver.Code, true);
            if (bomDetailList.Count > 0)
            {
                foreach (BomDetail bomDetail in bomDetailList)
                {
                    MaterialIn materialIn = new MaterialIn();
                    materialIn.Location = bomDetail.Location;
                    materialIn.Operation = bomDetail.Operation;
                    materialIn.RawMaterial = bomDetail.Item;

                    //来源库位查找逻辑BomDetail-->RoutingDetail-->FlowDetail-->Flow
                    Location bomLocFrom = bomDetail.Location;
                    if (flow.Routing != null)
                    {
                        //在Routing上查找,并检验Routing上的工序和BOM上的是否匹配
                        RoutingDetail routingDetail = routingDetailMgr.LoadRoutingDetail(flow.Routing, bomDetail.Operation, bomDetail.Reference);
                        if (routingDetail != null)
                        {
                            if (bomLocFrom == null)
                            {
                                bomLocFrom = routingDetail.Location;
                            }
                        }
                    }
                    if (bomLocFrom == null)
                    {
                        bomLocFrom = bomDetail.DefaultLocation;
                    }
                    materialIn.Location = bomLocFrom;
                    materialInList.Add(materialIn);
                }
            }
            #endregion
            List<Transformer> inTransformer = Utility.TransformerHelper.ConvertProductLineInProcessLocationDetailsToTransformers(productLineIpList);
            List<Transformer> newTransformer = Utility.TransformerHelper.ConvertMaterialInsToTransformers(materialInList);
            resolver.Transformers = MergeTransformers(inTransformer, newTransformer);
            resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMER;
        }
Пример #5
0
    public void InitPageParameter()
    {
        #region 已投料
        IList<ProductLineInProcessLocationDetail> productLineIpList = new List<ProductLineInProcessLocationDetail>();
        if (tbProductLine.Text.Trim() != string.Empty)
        {
            productLineIpList = TheProductLineInProcessLocationDetailMgr.GetProductLineInProcessLocationDetail(this.tbProductLine.Text.Trim(), BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE);
        }
        this.GV_List_Feeded.DataSource = productLineIpList;
        this.GV_List_Feeded.DataBind();
        #endregion

        #region 新投料
        //todo 根据flow得到Material的list
        IList<BomDetail> bomDetailList = new List<BomDetail>();
        IList<MaterialIn> materialInList = new List<MaterialIn>();
        if (this.tbProductLine.Text.Trim() != string.Empty)
        {
            bomDetailList = TheFlowMgr.GetBatchFeedBomDetail(this.tbProductLine.Text.Trim());
        }


        //暂时放在页面,后面再抽出来
        Flow flow = TheFlowMgr.LoadFlow(this.tbProductLine.Text.Trim(), true);
        if (bomDetailList != null && bomDetailList.Count > 0)
        {
            foreach (BomDetail bomDetail in bomDetailList)
            {
                MaterialIn materialIn = new MaterialIn();
                materialIn.Location = bomDetail.Location;
                materialIn.Operation = bomDetail.Operation;
                materialIn.RawMaterial = bomDetail.Item;

                //来源库位查找逻辑BomDetail-->RoutingDetail-->FlowDetail-->Flow
                Location bomLocFrom = bomDetail.Location;

                if (flow.Routing != null)
                {
                    //在Routing上查找,并检验Routing上的工序和BOM上的是否匹配
                    RoutingDetail routingDetail = TheRoutingDetailMgr.LoadRoutingDetail(flow.Routing, bomDetail.Operation, bomDetail.Reference);
                    if (routingDetail != null)
                    {
                        if (bomLocFrom == null)
                        {
                            bomLocFrom = routingDetail.Location;
                        }
                    }
                }

                if (bomLocFrom == null)
                {
                    bomLocFrom = bomDetail.DefaultLocation;

                }
                materialIn.Location = bomLocFrom;
                materialInList.Add(materialIn);
            }
        }
        this.GV_List.DataSource = materialInList;
        this.GV_List.DataBind();
        #endregion
    }
Пример #6
0
    private IList<MaterialIn> GetMaterialInList()
    {
        IList<MaterialIn> materialInList = new List<MaterialIn>();
        for (int i = 0; i < this.GV_List.Rows.Count; i++)
        {
            GridViewRow row = this.GV_List.Rows[i];
            string itemCode = ((Label)row.FindControl("lblItemCode")).Text.Trim();

            Label lblOperation = (Label)row.FindControl("lblOperation");
            int? operation = null;
            if (lblOperation.Text.Trim() != string.Empty)
            {
                operation = int.Parse(lblOperation.Text.Trim());
            }

            Label lblLocation = (Label)row.FindControl("lblLocation");

            TextBox tbQty = (TextBox)row.FindControl("tbQty");
            decimal qty = tbQty.Text.Trim() == string.Empty ? 0 : decimal.Parse(tbQty.Text.Trim());

            MaterialIn materialIn = new MaterialIn();
            materialIn.RawMaterial = TheItemMgr.LoadItem(itemCode);
            materialIn.Operation = operation;
            materialIn.Qty = qty;

            if (lblLocation.Text.Trim() != string.Empty)
            {
                materialIn.Location = TheLocationMgr.LoadLocation(lblLocation.Text.Trim());
            }
            if (materialIn.Qty != 0)
            {
                materialInList.Add(materialIn);
            }
        }
        return materialInList;
    }
Пример #7
0
        private MaterialIn ConvertTransformerDetailToMaterialIn(TransformerDetail transformerDetail)
        {
            MaterialIn materialIn = new MaterialIn();
            materialIn.HuId = transformerDetail.HuId;
            materialIn.RawMaterial = itemMgr.LoadItem(transformerDetail.ItemCode);
            materialIn.Location = locationMgr.LoadLocation(transformerDetail.LocationCode);
            materialIn.LotNo = transformerDetail.LotNo;
            materialIn.Operation = transformerDetail.Operation;
            materialIn.Qty = transformerDetail.Qty;

            return materialIn;
        }
Пример #8
0
        public void MaterialInScan(string huId, IList<MaterialIn> materialInList)
        {
            if (materialInList == null)
            {
                materialInList = new List<MaterialIn>();
            }

            LocationLotDetail locationLotDetail = locationLotDetailMgr.CheckLoadHuLocationLotDetail(huId);
            Hu hu = locationLotDetail.Hu;
            hu.Qty = locationLotDetail.Qty / hu.UnitQty;
            MaterialIn materialIn = new MaterialIn();
            materialIn.HuId = huId;
            materialIn.Location = locationLotDetail.Location;
            materialIn.RawMaterial = hu.Item;
            materialIn.LotNo = hu.LotNo;
            materialIn.Qty = hu.Qty * hu.UnitQty;
            materialInList.Add(materialIn);
        }