/// <summary> /// 赋值账务信息_出 /// </summary> /// <param name="ctx">数据上下文</param> /// <param name="lnqOutPut">单据信息</param> /// <param name="detail1">明细信息</param> /// <returns>返回账务信息对象</returns> S_FetchGoodsDetailBill AssignDetailInfo_Out(DepotManagementDataContext ctx, Business_WarehouseOutPut_OutPut lnqOutPut, View_Business_WarehouseOutPut_OutPutDetail detail1) { ServerModule.IStoreServer storeService = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IStoreServer>(); IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); CommonProcessInfo processInfo = new CommonProcessInfo(); CE_OutPutBusinessType OutPutType = GlobalObject.GeneralFunction.StringConvertToEnum <CE_OutPutBusinessType>(lnqOutPut.BillType); S_FetchGoodsDetailBill fetchDetail = new S_FetchGoodsDetailBill(); fetchDetail.AssociatedBillNo = detail1.关联业务; fetchDetail.AssociatedBillType = CE_BillTypeEnum.入库申请单.ToString(); fetchDetail.BatchNo = detail1.批次号; fetchDetail.BillTime = ServerTime.Time; fetchDetail.DepartDirector = ""; fetchDetail.Department = lnqOutPut.ApplyingDepartment; fetchDetail.Depot = UniversalFunction.GetGoodsInfo(detail1.物品ID).物品类别名称; fetchDetail.Price = 0; //Math.Round(detail1.单价 * detail1.数量, 2); fetchDetail.UnitPrice = 0; //detail1.单价; processInfo = serverFlow.GetFlowData(detail1.关联业务).First(); fetchDetail.FillInDate = Convert.ToDateTime(processInfo.时间); fetchDetail.FillInPersonnel = processInfo.人员; fetchDetail.FetchBIllID = lnqOutPut.BillNo; fetchDetail.FetchCount = detail1.数量; fetchDetail.GoodsID = detail1.物品ID; fetchDetail.OperationType = (int)GlobalObject.EnumOperation.OutPutBusinessTypeConvertToSubsidiaryOperationType(OutPutType); fetchDetail.Provider = detail1.供应商; fetchDetail.Remark = detail1.备注; fetchDetail.StorageID = lnqOutPut.StorageID; DataTable stockTable = storeService.GetGoodsStockInfo(fetchDetail.GoodsID, fetchDetail.BatchNo, fetchDetail.Provider, fetchDetail.StorageID); if (stockTable != null && stockTable.Rows.Count > 0) { fetchDetail.ProviderBatchNo = stockTable.Rows[0]["ProviderBatchNo"].ToString(); } else { fetchDetail.ProviderBatchNo = ""; } fetchDetail.Using = lnqOutPut.BillTypeDetail; return(fetchDetail); }
void SetInfo() { IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); if (_LnqBillInfo != null) { lbBillStatus.Text = serverFlow.GetNowBillStatus(_LnqBillInfo.BillNo); txtBillNo.Text = _LnqBillInfo.BillNo; txtAssetsNo.Text = _LnqBillInfo.AssetsNo; txtContact.Text = _LnqBillInfo.Contact; txtEvaluation.Text = _LnqBillInfo.Evaluation; txtMalfunctionApproach.Text = _LnqBillInfo.MalfunctionApproach; txtMalfunctionReason.Text = _LnqBillInfo.MalfunctionReason; txtMalfunctionSymptom.Text = _LnqBillInfo.MalfunctionSymptom; txtMalfunctionAddress.Text = _LnqBillInfo.MalfunctionAddress; numElapsedTime.Value = _LnqBillInfo.ElapsedTime == null ? 0 : (decimal)_LnqBillInfo.ElapsedTime; numExpenses.Value = _LnqBillInfo.Expenses == null ? 0 : (decimal)_LnqBillInfo.Expenses; numSatisfaction.Value = _LnqBillInfo.Satisfaction == null ? 0 : (decimal)_LnqBillInfo.Satisfaction; cmbSymptomType.Text = _LnqBillInfo.SymptomType == null ? "" : _LnqBillInfo.SymptomType; if (_LnqBillInfo.Solve != null) { GlobalObject.GeneralFunction.SetRadioButton(_LnqBillInfo.Solve, customGroupBox3); } List <CommonProcessInfo> lstTemp = serverFlow.GetFlowData(_LnqBillInfo.BillNo); CommonProcessInfo info = lstTemp.OrderBy(k => k.时间).First(); txtLinkPersonnel.Text = info.人员; } else { lbBillStatus.Text = CE_CommonBillStatus.新建单据.ToString(); _LnqBillInfo = new Business_Composite_ComputerMalfunction(); txtBillNo.Text = this.FlowInfo_BillNo; _LnqBillInfo.BillNo = txtBillNo.Text; txtLinkPersonnel.Text = BasicInfo.LoginName; } }
/// <summary> /// 赋值账务信息_入 /// </summary> /// <param name="ctx">数据上下文</param> /// <param name="lnqOutPut">单据信息</param> /// <param name="detail1">明细信息</param> /// <returns>返回账务信息对象</returns> S_InDepotDetailBill AssignDetailInfo_In(DepotManagementDataContext ctx, Business_WarehouseOutPut_OutPut lnqOutPut, View_Business_WarehouseOutPut_OutPutDetail detail1) { IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); CommonProcessInfo processInfo = new CommonProcessInfo(); CE_OutPutBusinessType OutPutType = GlobalObject.GeneralFunction.StringConvertToEnum <CE_OutPutBusinessType>(lnqOutPut.BillType); S_InDepotDetailBill inDepotDetail = new S_InDepotDetailBill(); inDepotDetail.AffrimPersonnel = BasicInfo.LoginName; inDepotDetail.BatchNo = detail1.批次号; inDepotDetail.BillTime = ServerTime.Time; inDepotDetail.Department = UniversalFunction.GetDeptName(lnqOutPut.ApplyingDepartment); inDepotDetail.Depot = UniversalFunction.GetGoodsInfo(detail1.物品ID).物品类别名称; inDepotDetail.FactPrice = 0; //Math.Round(detail1.单价 * detail1.数量, 2); inDepotDetail.FactUnitPrice = 0; //detail1.单价; inDepotDetail.Price = inDepotDetail.FactPrice; inDepotDetail.UnitPrice = inDepotDetail.FactUnitPrice; inDepotDetail.InvoicePrice = null; inDepotDetail.InvoiceUnitPrice = null; processInfo = serverFlow.GetFlowData(detail1.关联业务).First(); inDepotDetail.FillInDate = Convert.ToDateTime(processInfo.时间); inDepotDetail.FillInPersonnel = processInfo.人员; inDepotDetail.InDepotBillID = lnqOutPut.BillNo; inDepotDetail.InDepotCount = -detail1.数量; inDepotDetail.GoodsID = detail1.物品ID; inDepotDetail.OperationType = (int)GlobalObject.EnumOperation.OutPutBusinessTypeConvertToSubsidiaryOperationType(OutPutType); inDepotDetail.Provider = detail1.供应商; inDepotDetail.Remark = detail1.备注; inDepotDetail.StorageID = lnqOutPut.StorageID; return(inDepotDetail); }
/// <summary> /// 获得流程意见 /// </summary> /// <param name="billNo">单据号</param> /// <returns>返回LIST</returns> public List <CommonProcessInfo> GetProcessInfo(string billNo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; List <CommonProcessInfo> listResult = new List <CommonProcessInfo>(); CommonProcessInfo tempInfo = new CommonProcessInfo(); var varData = from a in ctx.FM_InstitutionProcess where a.BillNo == billNo select a; if (varData.Count() == 1) { FM_InstitutionProcess tempInstitution = varData.Single(); if (tempInstitution.GeneralManagerTime != null) { tempInfo = new CommonProcessInfo(); tempInfo.操作节点 = "总经理"; tempInfo.人员 = tempInstitution.GeneralManager; tempInfo.时间 = tempInstitution.GeneralManagerTime.ToString(); tempInfo.意见 = tempInstitution.GeneralManagerAdvise; listResult.Add(tempInfo); } if (tempInstitution.LeadershipTime != null) { tempInfo = new CommonProcessInfo(); tempInfo.操作节点 = "分管领导"; tempInfo.人员 = tempInstitution.Leadership; tempInfo.时间 = tempInstitution.LeadershipTime.ToString(); tempInfo.意见 = tempInstitution.LeadershipAdvise; listResult.Add(tempInfo); } var varPoint = (from a in ctx.FM_InstitutionProcessPointDept where a.BillNo == billNo && a.PersonnelTime != null select a).OrderBy(r => r.PersonnelType).ThenByDescending(r => r.PersonnelTime); foreach (FM_InstitutionProcessPointDept item in varPoint) { tempInfo = new CommonProcessInfo(); tempInfo.操作节点 = "相关部门" + item.PersonnelType; tempInfo.人员 = UniversalFunction.GetPersonnelInfo(item.Personnel).姓名; tempInfo.时间 = item.PersonnelTime.ToString(); tempInfo.意见 = item.Advise; listResult.Add(tempInfo); } if (tempInstitution.DepartmentHeadTime != null) { tempInfo = new CommonProcessInfo(); tempInfo.操作节点 = "部门负责人"; tempInfo.人员 = tempInstitution.DepartmentHead; tempInfo.时间 = tempInstitution.DepartmentHeadTime.ToString(); tempInfo.意见 = tempInstitution.DepartmentHeadAdvise; listResult.Add(tempInfo); } if (tempInstitution.ChiefTime != null) { tempInfo = new CommonProcessInfo(); tempInfo.操作节点 = "科长"; tempInfo.人员 = tempInstitution.Chief; tempInfo.时间 = tempInstitution.ChiefTime.ToString(); tempInfo.意见 = tempInstitution.ChiefAdvise; listResult.Add(tempInfo); } } return(listResult); }
void CreateMaterialRequisition(DepotManagementDataContext ctx, Business_WarehouseOutPut_WholeMachineRequisition billInfo, List <Business_WarehouseOutPut_WholeMachineRequisitionDetail> listDetail, List <Business_WarehouseOutPut_WholeMachineRequisition_StorageID> listStorage, out List <string> listBillNo) { listBillNo = null; ServerModule.IMaterialRequisitionGoodsServer serviceGoods = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IMaterialRequisitionGoodsServer>(); ServerModule.IMaterialRequisitionServer serviceBill = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IMaterialRequisitionServer>(); ServerModule.IStoreServer serviceStore = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IStoreServer>(); IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); ServerModule.IMaterialRequisitionPurposeServer servicePurpose = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IMaterialRequisitionPurposeServer>(); BillNumberControl billControl = new BillNumberControl(CE_BillTypeEnum.领料单, serviceBill); List <CommonProcessInfo> listProcessInfo = serviceFlow.GetFlowData(billInfo.BillNo); try { List <GoodsInfo> listGoodsInfo = new List <GoodsInfo>(); foreach (Business_WarehouseOutPut_WholeMachineRequisitionDetail detail in listDetail) { decimal requstCount = detail.GoodsCount; foreach (Business_WarehouseOutPut_WholeMachineRequisition_StorageID storage in listStorage) { if (requstCount == 0) { break; } List <View_S_Stock> lstStock = serviceStore.GetGoodsStoreOnlyForAssembly(detail.GoodsID, storage.StorageID).ToList(); foreach (View_S_Stock stock in lstStock) { if (requstCount == 0) { break; } if (stock.库存数量 <= requstCount) { GoodsInfo goodsInfo = new GoodsInfo(); goodsInfo.GoodsID = detail.GoodsID; goodsInfo.BatchNo = stock.批次号; goodsInfo.Provider = stock.供货单位; goodsInfo.GoodsCount = stock.库存数量; goodsInfo.ListInfo = new List <string>(); goodsInfo.ListInfo.Add(listGoodsInfo.Count.ToString()); goodsInfo.ListInfo.Add(storage.StorageID); goodsInfo.ListInfo.Add(stock.库存数量.ToString()); listGoodsInfo.Add(goodsInfo); requstCount = requstCount - stock.库存数量; } else { GoodsInfo goodsInfo = new GoodsInfo(); goodsInfo.GoodsID = detail.GoodsID; goodsInfo.BatchNo = stock.批次号; goodsInfo.Provider = stock.供货单位; goodsInfo.GoodsCount = requstCount; goodsInfo.ListInfo = new List <string>(); goodsInfo.ListInfo.Add(listGoodsInfo.Count.ToString()); goodsInfo.ListInfo.Add(storage.StorageID); goodsInfo.ListInfo.Add(detail.GoodsCount.ToString()); listGoodsInfo.Add(goodsInfo); requstCount = 0; } } } } if (listGoodsInfo != null && listGoodsInfo.Count > 0) { listBillNo = new List <string>(); CommonProcessInfo firstProcess = new CommonProcessInfo(); CommonProcessInfo SecondProcess = new CommonProcessInfo(); CommonProcessInfo ThridProcess = new CommonProcessInfo(); var varTemp = from a in listProcessInfo where a.操作节点 == "新建" orderby a.时间 descending select a; if (varTemp.Count() != 0) { firstProcess = varTemp.First(); } else { throw new Exception("此单据无【新建】流程"); } varTemp = from a in listProcessInfo where a.操作节点 == "审核" orderby a.时间 descending select a; if (varTemp.Count() != 0) { SecondProcess = varTemp.First(); } else { throw new Exception("此单据无【审核】流程"); } varTemp = from a in listProcessInfo where a.操作节点 == "确认" orderby a.时间 descending select a; if (varTemp.Count() != 0) { ThridProcess = varTemp.First(); } foreach (Business_WarehouseOutPut_WholeMachineRequisition_StorageID storage in listStorage) { List <GoodsInfo> listGoodsInfoTemp = (from a in listGoodsInfo where a.ListInfo[1].ToString() == storage.StorageID orderby Convert.ToInt32(a.ListInfo[0]) select a).ToList(); if (listGoodsInfoTemp.Count > 0) { string error = ""; S_MaterialRequisition bill = new S_MaterialRequisition(); bill.AssociatedBillNo = billInfo.BillNo; bill.AssociatedBillType = CE_BillTypeEnum.整台份请领单.ToString(); bill.Bill_ID = billControl.GetNewBillNo(ctx); bill.Bill_Time = ServerTime.Time; bill.BillStatus = "等待出库"; View_HR_Personnel personnelInfo = UniversalFunction.GetPersonnelInfo(firstProcess.工号); bill.Department = personnelInfo.部门编码; bill.DepartmentDirector = SecondProcess.人员; bill.DepotManager = ThridProcess == new CommonProcessInfo() ? BasicInfo.LoginName : ThridProcess.人员; bill.FetchCount = (int)billInfo.MachineCount; bill.FetchType = FetchGoodsType.整台领料.ToString(); bill.FillInPersonnel = firstProcess.人员; bill.FillInPersonnelCode = personnelInfo.工号; bill.ProductType = billInfo.ProductType; bill.PurposeCode = servicePurpose.GetBillPurpose(ctx, billInfo.BillTypeDetail).Code; bill.Remark = billInfo.Remark; bill.StorageID = storage.StorageID; if (!serviceBill.AutoCreateBill(ctx, bill, out error)) { throw new Exception(error); } listBillNo.Add(bill.Bill_ID); for (int i = 0; i < listGoodsInfoTemp.Count; i++) { S_MaterialRequisitionGoods goodsInfo = new S_MaterialRequisitionGoods(); goodsInfo.BasicCount = Convert.ToDecimal(listGoodsInfoTemp[i].ListInfo[2]); goodsInfo.BatchNo = listGoodsInfoTemp[i].BatchNo; goodsInfo.Bill_ID = bill.Bill_ID; goodsInfo.GoodsID = listGoodsInfoTemp[i].GoodsID; goodsInfo.ProviderCode = listGoodsInfoTemp[i].Provider; goodsInfo.RealCount = listGoodsInfoTemp[i].GoodsCount; goodsInfo.Remark = GetWorkBench_WashFlag(billInfo.ProductType, goodsInfo.GoodsID); goodsInfo.RequestCount = listGoodsInfoTemp[i].GoodsCount; IProductOrder serviceProductOrder = ServerModuleFactory.GetServerModule <IProductOrder>(); goodsInfo.ShowPosition = 0; //serviceProductOrder.GetPosition(ctx, billInfo.ProductType, goodsInfo.GoodsID); if (!serviceGoods.AutoCreateGoods(ctx, goodsInfo, out error)) { throw new Exception(error); } } } ctx.SubmitChanges(); } } } catch (Exception ex) { throw new Exception(ex.Message); } }