Beispiel #1
0
        private string GetItemSeq(string itemCode, string virItemCode)
        {
            string item_seq = "";
            List<PlanStandardBOMEntity> p;
            List<PlanStandardBOMEntity> lst_bom= PlanStandardBOMFactory.GetByOrderCodeAndWorkUnit(OrderCode, WorkunitCode);

            if (string.IsNullOrWhiteSpace(virItemCode))
            {
                p = (from s in lst_bom where s.ITEM_CODE == itemCode && s.VIRTUAL_ITEM_CODE == null select s).ToList();
            }
            else
            {

                p = (from s in lst_bom where s.ITEM_CODE == itemCode && s.VIRTUAL_ITEM_CODE == virItemCode select s).ToList();
            }

            item_seq = (p.Count * 10 + 10).ToString("0000");

            return item_seq;
        }
Beispiel #2
0
        private void CreateBomItem(string ItemCode,float ItemQty)
        {

            List<PlanStandardBOMEntity> lst_bom = PlanStandardBOMFactory.GetByOrderCodeAndWorkUnit(OrderCode, WorkunitCode);
            var sss = (from a in lst_bom where a.ITEM_CODE == ItemCode && a.WORKUNIT_CODE == WorkunitCode select a).ToList();
            if (sss.Count > 0)
            {
                MessageBox.Show("此物料在此工序BOM中已经存在");
                return;
            }
            PlanStandardBOMEntity ent_bom = lst_bom.First();
            ItemEntity ent_item = ItemFactory.GetByItem(CompanyCode, ItemCode);
            PlanStandardBOMEntity ent_bom1 = new PlanStandardBOMEntity
            {

                COMPANY_CODE = CompanyCode,
                CREATE_TIME = DateTime.Today,
                ITEM_CODE = ItemCode,
                ITEM_NAME = ent_item.ITEM_NAME,
                ITEM_QTY = ItemQty,
                ITEM_SEQ = GetItemSeq(ItemCode, cmbVItemCode.Text),
                PLAN_CODE = ent_bom.PLAN_CODE,
                LOCATION_CODE = ent_bom.LOCATION_CODE,
                PROCESS_CODE = ent_bom.PROCESS_CODE,
                PLINE_CODE = ent_bom.PLINE_CODE,
                VIRTUAL_ITEM_CODE = cmbVItemCode.Text.Split('-')[0],
                WORKSHOP_CODE = ent_bom.WORKSHOP_CODE,
                STORE_ID = ent_bom.STORE_ID,
                ORDER_CODE = ent_bom.ORDER_CODE,
                WORKUNIT_CODE = ent_bom.WORKUNIT_CODE,
                ITEM_UNIT = ent_item.UNIT_CODE,
                LINESIDE_STOCK_CODE = ent_bom.LINESIDE_STOCK_CODE,
                USER_CODE=LoginInfo.UserInfo.USER_CODE
            };

            DB.GetInstance().Insert(ent_bom1);
        }