Exemplo n.º 1
0
        /// <summary>
        ///物料  供应商  批次/SN  数量  工位  生产线
        /// </summary>
        /// <returns>int</returns>

        public static bool OutOfStorage(string itemCode, string vendorCode, string SN, string locationCode, string plineCode, float itemQTY)
        {
            try
            {
                LineSideStockEntity temp  = new LineSideStockEntity();
                LineSideStockDal    lsDal = new LineSideStockDal();
                temp = lsDal.GetByItem(locationCode, plineCode, itemCode);
                if (temp == null)
                {
                    Rmes.Public.ErrorHandle.EH.LASTMSG = "没有物料" + itemCode + "的相关记录,无法进行出库操作!\n";
                    lsDal.DataBase.AbortTransaction();
                    return(false);
                }
                else
                {
                    temp.ITEM_QTY = temp.ITEM_QTY - itemQTY;
                    if (temp.ITEM_QTY < 0)
                    {
                        Rmes.Public.ErrorHandle.EH.LASTMSG = itemCode + "库存不足,无法进行出库操作!\n";
                        lsDal.DataBase.AbortTransaction();
                        return(false);
                    }

                    lsDal.Update(temp);
                    return(true);
                }
            }
            catch (Exception e)
            {
                Rmes.Public.ErrorHandle.EH.LASTMSG = e.Message;
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 函数说明:入库操作,返回影响的行数
        /// </summary>
        ///
        /// <returns>int</returns>
        public static bool Storage(string itemCode, string vendorCode, string SN, string locationCode, string plineCode, float itemQTY)
        {
            LineSideStockEntity item = new LineSideStockEntity()
            {
                COMPANY_CODE  = LoginInfo.UserInfo.COMPANY_CODE,
                LOCATION_CODE = locationCode,
                ITEM_CODE     = itemCode,
                VENDOR_CODE   = vendorCode,
                PLINE_CODE    = plineCode,
                ITEM_QTY      = itemQTY
            };
            LineSideStockEntity temp  = new LineSideStockEntity();
            LineSideStockDal    lsDal = new LineSideStockDal();

            temp = lsDal.GetByItem(locationCode, plineCode, itemCode);
            if (temp == null)
            {
                lsDal.Insert(item);
                return(true);
            }
            else
            {
                temp.ITEM_QTY += item.ITEM_QTY;
                lsDal.Update(temp);
                return(true);
            }
        }
Exemplo n.º 3
0
        private void setCondition()
        {
            if (PlanCode.SelectedIndex < 0)
            {
                return;
            }

            List <string>        stores      = new System.Collections.Generic.List <string>();
            string               planCode    = PlanCode.SelectedItem.Value.ToString();
            List <PlanBomEntity> allEntities = PlanBOMFactory.GetByOrderCode(planCode);

            List <LineSideStockEntity> dataSource = new List <LineSideStockEntity>();

            foreach (var a in allEntities)
            {
                LineSideStockEntity ls = LineSideStockFactory.GetStoreItem(a.LINESIDE_STOCK_CODE, a.ITEM_CODE);
                if (ls != null)
                {
                    dataSource.Add(ls);
                    if (!stores.Contains(a.RESOURCE_STORE))
                    {
                        stores.Add(a.RESOURCE_STORE);//添加采购虚拟区
                    }
                }
            }
            ASPxGridView1.DataSource = dataSource;
            ASPxGridView1.DataBind();
            DestinationStore.Items.Clear();
            DestinationStore.Items.Add("CGXN", "CGXN");
            foreach (var s in stores)
            {
                DestinationStore.Items.Add(s, s);
            }
        }
Exemplo n.º 4
0
        private void btnReceive_Click(object sender, EventArgs e)
        {
            LineSideStockEntity ent = new LineSideStockEntity()
            {
                COMPANY_CODE  = CompanyCode,
                PLINE_CODE    = PlineCode,
                STORE_CODE    = LinesideStockCode,
                STORE_NAME    = LinesideStockName,
                LOCATION_CODE = WorkunitCode,
                WORKSHOP_CODE = WorkshopCode
            };
            FrmIssueReceived frmIssue = new FrmIssueReceived(ent);

            frmIssue.ShowDialog();
            InitLinesideStock();
        }
Exemplo n.º 5
0
        public static string TransToWMSStore(string planCode, string resourceStore, string itemCode, string destinationStore, int transQTY)
        {
            DB.GetInstance().BeginTransaction();
            try
            {
                List <PlanBomEntity> planBOMs = PlanBOMFactory.GetByOrderCode(planCode);
                planBOMs = (from p in planBOMs where p.ITEM_CODE == itemCode && p.LINESIDE_STOCK_CODE == resourceStore select p).ToList <PlanBomEntity>();
                List <LineSideStockEntity> all   = DB.GetInstance().Fetch <LineSideStockEntity>("");
                PlanBomEntity       resouece     = planBOMs[0];
                LineSideStockEntity rsourceStore = LineSideStockFactory.GetStoreItem(resourceStore, itemCode);
                LineSideStockEntity destination  = LineSideStockFactory.GetStoreItem(destinationStore, itemCode);
                rsourceStore.ITEM_QTY = rsourceStore.ITEM_QTY - transQTY;
                DB.GetInstance().Update(rsourceStore);

                IMESLine2LineEntity line2lineEntity = new IMESLine2LineEntity
                {
                    AUFNR  = resouece.ORDER_CODE,
                    WERKS  = resouece.FACTORY,
                    VORNR  = resouece.PROCESS_CODE,
                    SUBMAT = resouece.ITEM_CODE,
                    MENGE  = transQTY.ToString(),
                    TLGORT = destinationStore,
                    SLGORT = resourceStore,
                    PRIND  = "0",
                };
                DB.GetInstance().Insert(line2lineEntity);


                SAPMessageTransEntity msgEntity = new SAPMessageTransEntity
                {
                    MESSAGE_CODE = "0047",
                    WORK_DATE    = DateTime.Now,
                    HANDLE_FLAG  = "0",
                };
                DB.GetInstance().Insert(msgEntity);
                DB.GetInstance().CompleteTransaction();
                return("true");
            }
            catch (Exception e)
            {
                DB.GetInstance().AbortTransaction();
                return(e.Message);
            }
        }
Exemplo n.º 6
0
        private void setCondition()
        {
            if (PlanCode.SelectedIndex < 0)
            {
                return;
            }
            string planCode = PlanCode.SelectedItem.Value.ToString();
            List <PlanBomEntity> allEntities = PlanBOMFactory.GetByOrderCode(planCode);

            List <LineSideStockEntity> dataSource = new List <LineSideStockEntity>();

            foreach (var a in allEntities)
            {
                LineSideStockEntity ls = LineSideStockFactory.GetStoreItem(a.LINESIDE_STOCK_CODE, a.ITEM_CODE);
                if (ls != null)
                {
                    dataSource.Add(ls);
                }
            }
            ASPxGridView1.DataSource = dataSource;
            ASPxGridView1.DataBind();
        }
Exemplo n.º 7
0
        /// <summary>
        /// 函数说明:入库操作,返回影响的行数
        /// </summary>
        ///
        /// <returns>int</returns>
        public static int Storage(LineSideStockEntity item)
        {
            int result;
            LineSideStockEntity temp  = new LineSideStockEntity();
            LineSideStockDal    lsDal = new LineSideStockDal();

            temp = lsDal.GetByItem(item.LOCATION_CODE, item.PLINE_CODE, item.ITEM_CODE);
            if (temp == null)
            {
                lsDal.Insert(item);
                result = 1;
            }
            else
            {
                temp.ITEM_QTY += item.ITEM_QTY;
                result         = lsDal.Update(temp);
            }
            //插入收料流水
            IssueReceivedEntity ent = new IssueReceivedEntity()
            {
                COMPANY_CODE        = item.COMPANY_CODE,
                WORKSHOP_CODE       = item.WORKSHOP_CODE,
                PLINE_CODE          = item.PLINE_CODE,
                LOCATION_CODE       = item.LOCATION_CODE,
                LINESIDE_STOCK_CODE = item.STORE_CODE,
                ITEM_CODE           = item.ITEM_CODE,
                ITEM_NAME           = item.ITEM_NAME,
                ITEM_QTY            = item.ITEM_QTY,
                WORK_TIME           = DateTime.Now,
                USER_ID             = LoginInfo.UserInfo.USER_ID
            };

            new IssueReceivedDal().Insert(ent);

            return(result);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 函数说明:批量入库操作,返回影响的行数
        /// </summary>
        ///
        /// <returns>int</returns>
        public static int Storage(List <LineSideStockEntity> itemList)
        {
            int result             = 0;
            LineSideStockDal lsDal = new LineSideStockDal();

            lsDal.DataBase.BeginTransaction();
            foreach (LineSideStockEntity lsEntity in itemList)
            {
                LineSideStockEntity temp = new LineSideStockEntity();
                temp = lsDal.GetByItem(lsEntity.LOCATION_CODE, lsEntity.PLINE_CODE, lsEntity.ITEM_CODE);
                if (temp == null)
                {
                    lsDal.Insert(lsEntity);
                    result += 1;
                }
                else
                {
                    temp.ITEM_QTY += lsEntity.ITEM_QTY;
                    result        += lsDal.Update(temp);
                }
            }
            lsDal.DataBase.CompleteTransaction();
            return(result);
        }
Exemplo n.º 9
0
 public frmBomEmerg(LineSideStockEntity entity)
 {
     InitializeComponent();
     ent = entity;
 }
Exemplo n.º 10
0
 public int Update(LineSideStockEntity item)
 {
     return(db.Update(item));
 }
Exemplo n.º 11
0
 public void Insert(LineSideStockEntity item)
 {
     db.Insert("DATA_LINESIDE_STOCK", "RMES_ID", item);
 }
Exemplo n.º 12
0
 public FrmIssueReceived(LineSideStockEntity entity)
 {
     InitializeComponent();
     ent = entity;
 }