public bool DeliverProduct(string 产品编号, int 产品数量, string relatedPlanId) { try { ProductFlow proflow = new ProductFlow(); proflow.ProductId = 产品编号; proflow.OccurredTime = DateTime.Now; proflow.Type = "订单出库"; proflow.RelatedOrderId = orderId; proflow.RelatedPlanId = relatedPlanId; //proflow.UnqualifiedCount = 不合格产品数; proflow.Status = ProductionStatus.OUT; if (pdm.DeliverProduct(proflow, 产品数量)) { //ppm.UpdatePlanStatus(ProductionPlanStatus.STORED, text编号.Text); MessageBox.Show("产品" + 产品编号 + "出库成功!!!"); return(true); } else { MessageBox.Show("产品" + 产品编号 + "出库失败!!!"); } return(false); } catch (Exception ex) { return(false); } }
public static List <String> Validate(this ProductFlow entity, LanguageType?lType) { List <String> Errmsg = new List <string>(); if (entity.ProductIndex <= 0) { if (lType == LanguageType.Korea) { Errmsg.Add("상품이 선택되지 않았습니다."); } else { Errmsg.Add("商品が選択されてありません。。"); } } if (entity.ProductAmount <= 0) { if (lType == LanguageType.Korea) { Errmsg.Add("상품수량이 입력되지 않았습니다."); } else { Errmsg.Add("商品数量が入力されてありません。"); } } return(Errmsg); }
public ActionResult ReleaseInsert() { if (!SessionCheck(Define.Session.SESSION_CHECK)) { return(ErrorPage("/Home/Error")); } if (!CheckAuth()) { LogWriter.Instance().LogWrite(UserSession.UserId, "/Store/ReleaseInsert - Error"); return(base.Logout()); } LogWriter.Instance().LogWrite(UserSession.UserId, "/Store/ReleaseInsert"); ProductFlow flow = (ProductFlow)Session["productFlow"]; flow.State = Define.ProductFlow.OUTCOMESTANBY.ToString(); flow.ApplyType = Define.ProductFlow.APPLYTYPE_NORMAL; flow.CompanyCode = CompanySession.CompanyCode; flow.ProductBuyPrice = 0; //입고초기화 String pBuffer = flow.ProductName; flow.ProductName = null; productFlowDao.InsertProductFlow(flow); flow.ProductName = pBuffer; ViewBag.Flow = flow; ViewBag.totalprice = flow.ProductSellPrice * flow.ProductAmount; //세션 초기화 Session["productFlow"] = null; ViewBag.Commit = COMMIT_KANRYOU; Session[Define.Session.ACTION] = "ReleaseAdd"; return(View("~/Views/Store/Web/ReleaseAddCheck.cshtml", Define.MASTER_VIEW)); }
public ActionResult ReleaseAdd(String key) { if (!SessionCheck(Define.Session.SESSION_CHECK)) { return(ErrorPage("/Home/Error")); } if (!CheckAuth()) { LogWriter.Instance().LogWrite(UserSession.UserId, "/Store/ReleaseAdd - Error"); return(base.Logout()); } LogWriter.Instance().LogWrite(UserSession.UserId, "/Store/ReleaseAdd"); if (Object.Equals("BACK", key)) { ProductFlow pFlow = (ProductFlow)Session["productFlow"]; if (pFlow != null) { ViewBag.Flow = pFlow; ViewBag.totalprice = pFlow.ProductSellPrice * pFlow.ProductAmount; } } ViewBag.productlist = productInfoDao.GetProductNameList(CompanySession.CompanyCode); ViewBag.userInfo = UserSession; return(View("~/Views/Store/Web/ReleaseAdd.cshtml", Define.MASTER_VIEW)); }
private bool 产品入库(string 产品编号, int 产品数量, int 合格产品数) { try{ ProductFlow proflow = new ProductFlow(); proflow.ProductId = 产品编号; proflow.OccurredTime = DateTime.Now; proflow.Type = "生产入库"; proflow.RelatedOrderId = text相关订单编号.Text; proflow.RelatedPlanId = text编号.Text; proflow.UnqualifiedCount = 合格产品数; proflow.Status = ProductionStatus.IN; if (product.AddProduct(proflow, 产品数量)) { string state = ProductionPlanStatus.STORED; if (!checkBox内部计划.Checked) { state = ProductionPlanStatus.TO_BE_SHIP; // 扣除库存 product.UpdateProductStoreCount(-产品数量, 产品编号); } ppm.UpdatePlanStatus(state, text编号.Text); MessageBox.Show("产品生产成功!!!"); return(true); } else { MessageBox.Show("产品生产失败!!!"); } return(false); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } }
public ActionResult ReleaseApprovePage(Int64 idx) { if (!SessionCheck(Define.Session.SESSION_CHECK)) { return(ErrorPage("/Home/Error")); } if (!CheckAuth()) { LogWriter.Instance().LogWrite(UserSession.UserId, "/Store/ReleaseApprovePage - Error"); return(base.Logout()); } LogWriter.Instance().LogWrite(UserSession.UserId, "/Store/ReleaseApprovePage"); LanguageType?lType = GetLanguageType(); Dictionary <String, Object> sessionBuffer = new Dictionary <string, object>(); ProductFlow flow = productFlowDao.SelectProductFlow(idx, CompanySession.CompanyCode); ViewBag.Flow = flow; ViewBag.totalprice = flow.ProductSellPrice * flow.ProductAmount; sessionBuffer.Add("FLOW", flow); if (flow.ApplyType != 0) { //발주서 검색 OrderTable pOrder = orderTableDao.SelectOrderTable(flow.ApplyType, CompanySession.CompanyCode); //정상경로가 아님 if (pOrder.Idx <= 0) { return(ErrorPage("/Home/Error")); } sessionBuffer.Add("ORDER", pOrder); //문서정보 취득 Document pDoc = documentDao.SelectDocument(pOrder.Idx, DOCUMENTSTORECODE, CompanySession.CompanyCode); sessionBuffer.Add("DOCUMENT", pDoc); //서버 상품 검색 IList <OrderTableSub> orderSubList = orderTableSubDao.SelectSubList(pOrder.Idx, CompanySession.CompanyCode, lType); sessionBuffer.Add("SUBLIST", orderSubList); //기본 데이터 Attribute저장 ViewBag.doc = pDoc; ViewBag.order = pOrder; ViewBag.orderSub = orderSubList; //전체 금액 계산 ViewBag.totalMoney = orderSubList.Sum((pSub) => { return(pSub.ProductMoney); }); //코드마스터 취득 ViewBag.moneySendType = CodeMasterMap.Instance().GetCodeMaster(Define.CodeMaster.MONEY_SEND_TYPE, lType); } Session["ApproveData"] = sessionBuffer; ViewBag.Commit = COMMIT_SHOUNINNPAGE; Session[Define.Session.ACTION] = "ReleaseCheckList"; return(View("~/Views/Store/Web/ReleaseCheckPage.cshtml", Define.MASTER_VIEW)); }
//产品进出仓 public bool AddNewProductFlow(ProductFlow pdt) { try { string sql = "INSERT INTO qiaotai.产品进出库(产品编号,发生时间,类型,相关订单编号,相关计划编号,不合格产品数,当前状态) VALUES ('" + pdt.ProductId + "','" + pdt.OccurredTime.ToString("yyyy/MM/dd HH:mm:ss") + "','" + pdt.Type + "','" + pdt.RelatedOrderId + "','" + pdt.RelatedPlanId + "','" + pdt.UnqualifiedCount + "','" + pdt.Status + "');"; MySqlCommand cmd = new MySqlCommand(sql, this.Connection); this.Connection.Open(); cmd.ExecuteNonQuery(); this.Connection.Close(); return(true); } catch (Exception ex) { this.Connection.Close(); throw ex; } }
public ActionResult ReleaseAddCheck(ProductFlow pFlow) { if (!SessionCheck(Define.Session.SESSION_CHECK)) { return(ErrorPage("/Home/Error")); } if (!CheckAuth()) { LogWriter.Instance().LogWrite(UserSession.UserId, "/Store/ReleaseAddCheck - Error"); return(base.Logout()); } LogWriter.Instance().LogWrite(UserSession.UserId, "/Store/ReleaseAddCheck"); LanguageType?lType = GetLanguageType(); Session[Define.Session.ACTION] = "ReleaseAdd"; List <String> pErrmsg = pFlow.Validate(lType); IList <ProductInfo> productList = productInfoDao.GetProductNameList(CompanySession.CompanyCode); //에러가 있는 경우 if (pErrmsg.Count > 0) { String err = ""; foreach (String pData in pErrmsg) { err += pData + "<br>"; } ViewBag.ErrMsg = err; ViewBag.Flow = pFlow; ViewBag.totalprice = pFlow.ProductSellPrice * pFlow.ProductAmount; ViewBag.productlist = productList; ViewBag.userInfo = UserSession; return(View("~/Views/Store/Web/ReleaseAdd.cshtml", Define.MASTER_VIEW)); } //정상의 경우 foreach (ProductInfo pData in productList) { if (pData.Idx == pFlow.ProductIndex) { pFlow.ProductName = pData.ProductName; break; } } ViewBag.Flow = pFlow; ViewBag.totalprice = pFlow.ProductSellPrice * pFlow.ProductAmount; Session["productFlow"] = pFlow; ViewBag.Commit = COMMIT_KAKUNINN; return(View("~/Views/Store/Web/ReleaseAddCheck.cshtml", Define.MASTER_VIEW)); }
public bool DeliverProduct(ProductFlow proflow, int 产品数量) { if (pdao.AddNewProductFlow(proflow)) { if (pdao.ReduceProductCount(proflow.ProductId, 产品数量)) { return(true); } else { return(false); } } else { return(false); } }
public bool AddProduct(ProductFlow pdt, int num) { if (pdao.AddNewProductFlow(pdt)) { if (pdao.AddProductCount(pdt.ProductId, num)) { return(true); } else { return(false); } } else { return(false); } }
public static void CreateProductFlow(int product_id, string product_title, int Administrators_Id, string admin_name, string flow_detail, string status) { using (var ctx = new RachnaDBContext()) { ProductFlow _product = new ProductFlow() { Product_Id = product_id, Product_Title = product_title, Administrators_Id = Administrators_Id, Product_Flow_CreatedBy = admin_name, Product_Flow_Detail = flow_detail, Product_Flow_CreatedDate = DateTime.Now, Product_Status = status }; ctx.ProductFlow.Add(_product); ctx.SaveChanges(); } }
public ActionResult Approve(string key = "") { if (!SessionCheck(Define.Session.SESSION_CHECK)) { return(ErrorPage("/Home/Error")); } if (!CheckAuth()) { LogWriter.Instance().LogWrite(UserSession.UserId, "/Delivery/Approve - Error"); return(base.Logout()); } LogWriter.Instance().LogWrite(UserSession.UserId, "/Delivery/Approve"); //정상경로가 아님 if (!String.IsNullOrEmpty(key) && !Object.Equals(Define.APPROVE, key) && !Object.Equals(Define.CANCEL, key)) { return(ErrorPage("/Home/Error")); } Document pDoc = (Document)Session["orderDOC"]; OrderTable pOrder = (OrderTable)Session["order"]; IList <OrderTableSub> pSubOrder = (IList <OrderTableSub>)Session["orderSub"]; String InputSessionkey = (String)Session["orderCheck"]; Session["orderDOC"] = null; Session["order"] = null; Session["orderSub"] = null; Session["orderCheck"] = null; //비정상경로 if (pDoc == null || pOrder == null || pSubOrder == null || InputSessionkey == null) { return(Redirect("/Obtain/Order")); } //비정상경로 if (!ORDERSESSIONKEY.Equals(InputSessionkey)) { return(Redirect("/Obtain/Order")); } //등록처리 if (Object.Equals(Define.APPROVE, key)) { orderTableDao.Approve(pOrder.Idx, App_Code.Define.STATE_APPLY, CompanySession.CompanyCode); //납품확인서 처리 DeliveryTable delivery = new DeliveryTable(); delivery.OrderCompany = pOrder.OrderName; delivery.OrderAddress = pOrder.OrderAddress; delivery.OrderSavedate = pOrder.OrderSaveDate; delivery.InorderCompany = CompanySession.CompanyName; delivery.InorderRepresentative = CompanySession.Representative; delivery.Creater = UserSession.UserName; delivery.CreateDate = DateTime.Now; delivery.State = App_Code.Define.STATE_NORMAL.ToString(); delivery.CompanyCode = CompanySession.CompanyCode; deliveryTableDao.InsertDelivery(delivery); Int64 deliverylastIndex = deliveryTableDao.GetScopeIndentity(); Document doc = new Document(); doc.DocumentCode = documentDao.CreateCode(); doc.DocumentType = DOCUMENTDELIVERYCODE; doc.DocumentIndex = delivery.Idx; doc.CreateDate = DateTime.Now; doc.Creater = UserSession.UserName; doc.State = App_Code.Define.STATE_NORMAL.ToString(); doc.CompanyCode = CompanySession.CompanyCode; documentDao.InsertDocument(doc); foreach (OrderTableSub data in pSubOrder) { //재고처리 ProductFlow product = new ProductFlow(); product.ProductIndex = data.ProductIndex; product.ProductAmount = data.ProductAmount; product.ProductSellPrice = data.ProductPrice; product.State = Define.ProductFlow.OUTCOMESTANBY.ToString(); product.CompanyCode = CompanySession.CompanyCode; product.ApplyType = pOrder.Idx; product.Creater = UserSession.UserId; product.CreteDate = DateTime.Now; productFlowDao.InsertProductFlow(product); //납품확인서(서브) 처리 DeliveryTableSub deliverySub = new DeliveryTableSub(); deliverySub.DeliveryKey = delivery.Idx; deliverySub.Number = data.Number; deliverySub.ProductIndex = data.ProductIndex; deliverySub.ProductSpec = data.ProductSpec; deliverySub.ProductType = data.ProductType; deliverySub.ProductAmount = data.ProductAmount; deliverySub.ProductPrice = data.ProductPrice; deliverySub.ProductVat = 0; deliverySub.Creater = UserSession.UserId; deliverySub.CreateDate = DateTime.Now; deliverySub.State = App_Code.Define.STATE_NORMAL.ToString(); deliverySub.CompanyCode = CompanySession.CompanyCode; deliveryTableSubDao.InsertDeliveryTableSub(deliverySub); } //청구서 작성 Bill bill = new Bill(); bill.InorderCompany = CompanySession.CompanyName; bill.InorderRepresentative = CompanySession.Representative; bill.InorderPost = CompanySession.CompanyPostNumber; bill.InorderAddress = CompanySession.CompanyAddress; bill.OrderCompany = pOrder.OrderName; bill.OrderAddress = pOrder.OrderAddress; bill.BillDate = pOrder.PayDate; bill.BillMoney = pOrder.OrderMoney; bill.BillTax = 0; bill.BillTotal = bill.BillMoney + bill.BillTax; bill.Creater = UserSession.UserName; bill.CreateDate = DateTime.Now; bill.State = App_Code.Define.STATE_NORMAL.ToString(); bill.CompanyCode = CompanySession.CompanyCode; billDao.InsertBill(bill); Int64 billLastIndex = billDao.GetScopeIndentity(); Document doc2 = new Document(); doc2.DocumentCode = documentDao.CreateCode(); doc2.DocumentType = DOCUMENTBILLCODE; doc2.DocumentIndex = bill.Idx; doc2.CreateDate = DateTime.Now; doc2.Creater = UserSession.UserName; doc2.State = App_Code.Define.STATE_NORMAL.ToString(); doc2.CompanyCode = CompanySession.CompanyCode; documentDao.InsertDocument(doc2); //기본ViewBag 설정 ViewSetting(pDoc, pOrder, pSubOrder); ViewBag.Commit = COMMIT_SHOUNINN_COMPLATE; Session[Define.Session.ACTION] = "DeliveryApproveList"; return(View("~/Views/Delivery/Web/DeliveryApproveCheck.cshtml", Define.MASTER_VIEW)); } else if (Object.Equals(Define.CANCEL, key)) { //등록 orderTableDao.Approve(pOrder.Idx, App_Code.Define.STATE_DELETE, CompanySession.CompanyCode); pSubOrder.AsParallel().ForAll((data) => { orderTableSubDao.ModifyState(data.Idx, App_Code.Define.STATE_DELETE, CompanySession.CompanyCode); }); ViewBag.Commit = COMMIT_SHOUNINN_CANCLE; //기본ViewBag 설정 ViewSetting(pDoc, pOrder, pSubOrder); Session[Define.Session.ACTION] = "DeliveryApproveList"; return(View("~/Views/Delivery/Web/DeliveryApproveCheck.cshtml", Define.MASTER_VIEW)); } else { return(ErrorPage("/Home/Error")); } }
public ActionResult ReleaseApprove(String key) { if (!SessionCheck(Define.Session.SESSION_CHECK)) { return(ErrorPage("/Home/Error")); } if (!CheckAuth()) { LogWriter.Instance().LogWrite(UserSession.UserId, "/Store/ReleaseApprove - Error"); return(base.Logout()); } LogWriter.Instance().LogWrite(UserSession.UserId, "/Store/ReleaseApprove"); Dictionary <String, Object> sessionBuffer = (Dictionary <String, Object>)Session["ApproveData"]; if (sessionBuffer == null) { return(ErrorPage("/Home/Error")); } else { Session["ApproveData"] = null; } LanguageType?lType = GetLanguageType(); ProductFlow flow = (ProductFlow)sessionBuffer["FLOW"]; ViewBag.Flow = flow; ViewBag.totalprice = flow.ProductSellPrice * flow.ProductAmount; if (flow.ApplyType != 0) { OrderTable order = (OrderTable)sessionBuffer["ORDER"]; Document doc = (Document)sessionBuffer["DOCUMENT"]; IList <OrderTableSub> orderSubList = (IList <OrderTableSub>)sessionBuffer["SUBLIST"]; //코드마스터 취득 ViewBag.moneySendType = CodeMasterMap.Instance().GetCodeMaster(Define.CodeMaster.MONEY_SEND_TYPE, lType); //기본 데이터 Attribute저장 ViewBag.doc = doc; ViewBag.order = order; ViewBag.orderSub = orderSubList; //전체 금액 계산 ViewBag.totalMoney = orderSubList.Sum((pSub) => { return(pSub.ProductMoney); });; } //등록부분 if (Object.Equals(Define.APPROVE, key)) { productFlowDao.ApproveProduct(flow.Idx, CompanySession.CompanyCode, Define.ProductFlow.OUTPUTCOMPLATE); Cargo cargo = new Cargo(); cargo.ProductIndex = flow.ProductIndex; cargo.ProductInput = 0; cargo.ProductOutput = flow.ProductAmount; cargo.ProductMoney = flow.ProductAmount * flow.ProductSellPrice; cargo.Creater = UserSession.Creater; cargo.CreateDate = DateTime.Now; cargo.State = Define.STATE_NORMAL.ToString(); cargo.CompanyCode = CompanySession.CompanyCode; cargoDao.InsertCargo(cargo); ViewBag.Commit = COMMIT_SHOUNINN; } else { productFlowDao.ApproveProduct(flow.Idx, CompanySession.CompanyCode, Define.ProductFlow.OUTPUTCANCEL); ViewBag.Commit = COMMIT_SHOUNINNCANCEL; } Session[Define.Session.ACTION] = "ReleaseCheckList"; return(View("~/Views/Store/Web/ReleaseCheckPage.cshtml", Define.MASTER_VIEW)); }
public ActionResult Approve(string key = "") { if (!SessionCheck(Define.Session.SESSION_CHECK)) { return(ErrorPage("/Home/Error")); } if (!CheckAuth()) { LogWriter.Instance().LogWrite(UserSession.UserId, "/Obtain/Approve - Error"); return(base.Logout()); } LogWriter.Instance().LogWrite(UserSession.UserId, "/Obtain/Approve"); //정상경로가 아님 if (!String.IsNullOrEmpty(key) && !String.Equals(Define.APPROVE, key) && !String.Equals(Define.CANCEL, key)) { return(ErrorPage("/Home/Error")); } Document doc = (Document)Session["orderDOC"]; OrderTable order = (OrderTable)Session["order"]; IList <OrderTableSub> orderSubList = (IList <OrderTableSub>)Session["orderSub"]; String InputSessionkey = (String)Session["orderCheck"]; //비정상경로 if (doc == null || order == null || orderSubList == null || InputSessionkey == null) { return(Redirect("/Obtain/Order")); } //비정상경로 if (!ORDERSESSIONKEY.Equals(InputSessionkey)) { return(Redirect("/Obtain/Order")); } Session["orderDOC"] = null; Session["order"] = null; Session["orderSub"] = null; Session["orderCheck"] = null; //등록처리 if (String.Equals(Define.APPROVE, key)) { //등록 orderTableDao.Approve(order.Idx, App_Code.Define.STATE_APPLY, CompanySession.CompanyCode); foreach (OrderTableSub data in orderSubList) { //재고등록 ProductFlow productFlow = new ProductFlow(); productFlow.ProductIndex = data.ProductIndex; productFlow.ProductAmount = data.ProductAmount; productFlow.ProductBuyPrice = data.ProductPrice; productFlow.ProductSellPrice = 0; productFlow.State = Define.ProductFlow.INCOMESTANBY.ToString(); productFlow.CompanyCode = CompanySession.CompanyCode; productFlow.ApplyType = order.Idx; productFlow.Creater = UserSession.UserId; productFlow.CreteDate = DateTime.Now; productFlowDao.InsertProductFlow(productFlow); //등록 orderTableSubDao.ModifyState(data.Idx, App_Code.Define.STATE_APPLY, CompanySession.CompanyCode); } ViewBag.Commit = COMMIT_SHOUNINN_COMPLATE; //기본ViewBag 설정 ViewSetting(doc, order, orderSubList); Session[Define.Session.ACTION] = "OrderApproveList"; return(View("~/Views/Obtain/Web/OrderApproveCheck.cshtml", Define.MASTER_VIEW)); } //승인취소 else if (String.Equals(Define.CANCEL, key)) { //등록 orderTableDao.Approve(order.Idx, App_Code.Define.STATE_DELETE, CompanySession.CompanyCode); foreach (OrderTableSub data in orderSubList) { //등록 orderTableSubDao.ModifyState(data.Idx, App_Code.Define.STATE_DELETE, CompanySession.CompanyCode); } ViewBag.Commit = COMMIT_SHOUNINN_CANCLE; //기본ViewBag 설정 ViewSetting(doc, order, orderSubList); Session[Define.Session.ACTION] = "OrderApproveList"; return(View("~/Views/Obtain/Web/OrderApproveCheck.cshtml", Define.MASTER_VIEW)); } else { return(ErrorPage("/Home/Error")); } }