/// <summary> /// 仓管确认事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAffirm_Click(object sender, EventArgs e) { if (m_intDJID != 0 && m_strDJZTFlag == "已检验") { DataTable dtTemp = (DataTable)dgv_Main.DataSource; for (int i = 0; i < dtTemp.Rows.Count; i++) { if (!m_serverProductCode.IsFitCount(Convert.ToInt32(dtTemp.Rows[i]["CPID"]), Convert.ToInt32(dtTemp.Rows[i]["Count"]), m_strDJH)) { MessageBox.Show("请对产品设置流水号,并保证产品数量与流水号数一致", "提示"); return; } } if (m_findSellIn.AffrimBill(m_intDJID, CE_MarketingType.退库, (DataTable)dgv_Main.DataSource, out m_err)) { MessageBox.Show("确认完毕!", "提示"); #region 发送知会消息 List <string> noticeRoles = new List <string>(); string strDept = m_serverDepartment.GetDeptInfoFromPersonnelInfo( m_findSellIn.GetBill(m_strDJH, m_intDJID).Rows[0]["LRRY"].ToString()).Rows[0]["DepartmentCode"].ToString(); noticeRoles.AddRange(m_billMessageServer.GetDeptDirectorRoleName(strDept)); noticeRoles.Add(CE_RoleEnum.质量工程师.ToString()); noticeRoles.Add(m_billMessageServer.GetRoleStringForStorage(cmbStorage.Text).ToString()); m_billMessageServer.EndFlowMessage(txtSellID.Text, string.Format("{0} 号营销退库单已经处理完毕", txtSellID.Text), noticeRoles, null); #endregion 发送知会消息 m_billNoControl.UseBill(txtSellID.Text); this.Close(); } else { MessageDialog.ShowErrorMessage(m_err); return; } } else if (m_intDJID != 0) { MessageBox.Show("请重新确认单据状态!", "提示"); return; } else { MessageBox.Show("单据ID无效,请重新确认!", "提示"); return; } }
private bool customForm_PanelGetDateInfo(CE_FlowOperationType flowOperationType) { try { if (!CheckData()) { return(false); } m_lnqBillInfo = new Business_WarehouseInPut_Requisition(); m_lnqBillInfo.BillNo = txtBillNo.Text; m_lnqBillInfo.BillType = cmbBillType.Text; m_lnqBillInfo.BillTypeDetail = txtTypeDetail.Text; m_lnqBillInfo.ApplyingDepartment = txtApplyingDepartment.Tag.ToString(); m_lnqBillInfo.IsConfirmArrival = chbIsConfirmArrival.Checked; m_lnqBillInfo.Remark = txtRemark.Text; List <View_Business_WarehouseInPut_RequisitionDetail> listTemp = new List <View_Business_WarehouseInPut_RequisitionDetail>(); foreach (DataGridViewRow dgvr in customDataGridView1.Rows) { View_Business_WarehouseInPut_RequisitionDetail detailTemp = new View_Business_WarehouseInPut_RequisitionDetail(); detailTemp.备注 = dgvr.Cells["备注"].Value == null ? "" : dgvr.Cells["备注"].Value.ToString(); detailTemp.单据号 = txtBillNo.Text; detailTemp.单位 = dgvr.Cells["单位"].Value == null ? "" : dgvr.Cells["单位"].Value.ToString(); detailTemp.供应商 = dgvr.Cells["供应商"].Value == null ? "" : dgvr.Cells["供应商"].Value.ToString(); detailTemp.关联业务 = dgvr.Cells["关联业务"].Value == null ? "" : dgvr.Cells["关联业务"].Value.ToString(); detailTemp.规格 = dgvr.Cells["规格"].Value == null ? "" : dgvr.Cells["规格"].Value.ToString(); detailTemp.检验报告 = Convert.ToBoolean(dgvr.Cells["检验报告"].Value); detailTemp.批次号 = dgvr.Cells["批次号"].Value == null ? "" : dgvr.Cells["批次号"].Value.ToString(); detailTemp.数量 = Convert.ToDecimal(dgvr.Cells["数量"].Value); detailTemp.图号型号 = dgvr.Cells["图号型号"].Value == null ? "" : dgvr.Cells["图号型号"].Value.ToString(); detailTemp.物品ID = Convert.ToInt32(dgvr.Cells["物品ID"].Value); detailTemp.物品名称 = dgvr.Cells["物品名称"].Value == null ? "" : dgvr.Cells["物品名称"].Value.ToString(); switch (GlobalObject.GeneralFunction.StringConvertToEnum <CE_InPutBusinessType>(m_lnqBillInfo.BillType)) { case CE_InPutBusinessType.生产采购: case CE_InPutBusinessType.普通采购: case CE_InPutBusinessType.委外采购: case CE_InPutBusinessType.样品采购: case CE_InPutBusinessType.自制件入库: break; case CE_InPutBusinessType.领料退库: case CE_InPutBusinessType.营销入库: case CE_InPutBusinessType.营销退库: IProductCodeServer serverProductCode = ServerModule.ServerModuleFactory.GetServerModule <IProductCodeServer>(); if (!serverProductCode.IsFitCount(detailTemp.物品ID, Convert.ToInt32(detailTemp.数量), detailTemp.单据号)) { MessageBox.Show("请对CVT/TCU设置流水编号,并保证产品数量与流水编号数一致", "提示"); return(false); } break; default: break; } listTemp.Add(detailTemp); } this.FlowInfo_BillNo = txtBillNo.Text; this.ResultInfo = listTemp; this.ResultList = new List <object>(); this.ResultList.Add(m_lnqBillInfo); this.ResultList.Add(flowOperationType); return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
/// <summary> /// 仓管确认事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAffirm_Click(object sender, EventArgs e) { if (m_intDJID != 0 && m_strDJZTFlag == "已批准") { DataTable dtTemp = (DataTable)dgv_Main.DataSource; BASE_Storage storageInfo_Out = UniversalFunction.GetStorageInfo(cmbOutStorage.Text); BASE_Storage storageInfo_In = UniversalFunction.GetStorageInfo(cmbInStorage.Text); if (storageInfo_In.StorageID == storageInfo_Out.StorageID) { throw new Exception("【入库库房】与【出库库房】是同一库房,无法操作"); } if (storageInfo_In.ZeroCostFlag != storageInfo_Out.ZeroCostFlag) { throw new Exception("【入库库房】与【出库库房】财务结算属性不一致,不能相互调拨"); } for (int i = 0; i < dtTemp.Rows.Count; i++) { if (!m_serverProductCode.IsFitCount(Convert.ToInt32(dtTemp.Rows[i]["GoodsID"]), Convert.ToInt32(dtTemp.Rows[i]["Count"]), m_strDJH)) { MessageBox.Show("请对产品设置流水号,并保证产品数量与流水号数一致", "提示"); return; } } if (m_serverCannibalize.AffirmBill(m_intDJID, out m_err)) { #region 发送知会消息 List <string> noticeRoles = new List <string>(); string strDept = m_serverDepartment.GetDeptInfoFromPersonnelInfo( m_serverCannibalize.GetBill(m_intDJID).LRRY).Rows[0]["DepartmentCode"].ToString(); noticeRoles.AddRange(m_billMessageServer.GetDeptDirectorRoleName(strDept)); noticeRoles.Add(m_billMessageServer.GetRoleStringForStorage(cmbOutStorage.Text).ToString()); noticeRoles.Add(m_billMessageServer.GetRoleStringForStorage(cmbInStorage.Text).ToString()); noticeRoles.Add(CE_RoleEnum.财务主管.ToString()); noticeRoles.Add(CE_RoleEnum.会计.ToString()); m_billMessageServer.EndFlowMessage(txtSellID.Text, string.Format("{0} 号库房调拨单已经处理完毕", txtSellID.Text), noticeRoles, null); #endregion 发送知会消息 MessageBox.Show("确认完毕!", "提示"); m_billNoControl.UseBill(txtSellID.Text); this.Close(); } else { MessageDialog.ShowErrorMessage(m_err); return; } } else if (m_intDJID != 0) { MessageBox.Show("请重新确认单据状态!", "提示"); return; } else { MessageBox.Show("单据ID无效,请重新确认!", "提示"); return; } }
private bool customForm_PanelGetDateInfo(CE_FlowOperationType flowOperationType) { try { if (!CheckData()) { return(false); } m_lnqBillInfo = new Business_WarehouseInPut_InPut(); m_lnqBillInfo.BillNo = txtBillNo.Text; m_lnqBillInfo.BillType = cmbBillType.Text; m_lnqBillInfo.BillTypeDetail = cmbTypeDetail.Text; m_lnqBillInfo.ApplyingDepartment = txtApplyingDepartment.Tag.ToString(); m_lnqBillInfo.StorageID = cmbStorage.SelectedValue.ToString(); m_lnqBillInfo.Remark = txtRemark.Text; List <View_Business_WarehouseInPut_InPutDetail> listTemp = new List <View_Business_WarehouseInPut_InPutDetail>(); foreach (DataGridViewRow dgvr in customDataGridView1.Rows) { View_Business_WarehouseInPut_InPutDetail detailTemp = new View_Business_WarehouseInPut_InPutDetail(); detailTemp.备注 = dgvr.Cells["备注"].Value == null ? "" : dgvr.Cells["备注"].Value.ToString(); detailTemp.单据号 = txtBillNo.Text; detailTemp.单位 = dgvr.Cells["单位"].Value == null ? "" : dgvr.Cells["单位"].Value.ToString(); detailTemp.供应商 = dgvr.Cells["供应商"].Value == null ? "" : dgvr.Cells["供应商"].Value.ToString(); detailTemp.关联业务 = dgvr.Cells["关联业务"].Value == null ? "" : dgvr.Cells["关联业务"].Value.ToString(); detailTemp.规格 = dgvr.Cells["规格"].Value == null ? "" : dgvr.Cells["规格"].Value.ToString(); detailTemp.批次号 = dgvr.Cells["批次号"].Value == null ? "" : dgvr.Cells["批次号"].Value.ToString(); detailTemp.数量 = Convert.ToDecimal(dgvr.Cells["数量"].Value); detailTemp.图号型号 = dgvr.Cells["图号型号"].Value == null ? "" : dgvr.Cells["图号型号"].Value.ToString(); detailTemp.物品ID = Convert.ToInt32(dgvr.Cells["物品ID"].Value); detailTemp.物品名称 = dgvr.Cells["物品名称"].Value == null ? "" : dgvr.Cells["物品名称"].Value.ToString(); if (detailTemp.供应商 == "") { throw new Exception(UniversalFunction.GetGoodsMessage(detailTemp.物品ID) + "批次号:【" + detailTemp.批次号 + "】,供应商为空,请选择供应商"); } switch (GlobalObject.GeneralFunction.StringConvertToEnum <CE_InPutBusinessType>(m_lnqBillInfo.BillType)) { case CE_InPutBusinessType.生产采购: case CE_InPutBusinessType.普通采购: case CE_InPutBusinessType.委外采购: case CE_InPutBusinessType.样品采购: case CE_InPutBusinessType.自制件入库: break; case CE_InPutBusinessType.领料退库: case CE_InPutBusinessType.营销入库: case CE_InPutBusinessType.营销退库: if (!m_serverProductCode.IsFitCount(detailTemp.物品ID, Convert.ToInt32(detailTemp.数量), detailTemp.单据号)) { MessageBox.Show("请对产品设置流水号,并保证产品数量与流水号数一致", "提示"); return(false); } break; default: break; } listTemp.Add(detailTemp); } this.FlowInfo_BillNo = txtBillNo.Text; this.ResultInfo = listTemp; this.ResultList = new List <object>(); this.ResultList.Add(m_lnqBillInfo); this.ResultList.Add(flowOperationType); return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
/// <summary> /// 保存单据 /// </summary> /// <param name="billNo">单据号</param> /// <param name="bill">要保存的单据对象</param> /// <param name="goodsList">要保存的报废物品清单</param> /// <param name="error">出错时返回的错误信息</param> /// <returns>操作是否成功的标志</returns> public bool SaveGoods(string billNo, S_ScrapBill bill, List <View_S_ScrapGoods> goodsList, out string error) { error = null; ScrapBillServer serverScrapBill = new ScrapBillServer(); try { DepotManagementDataContext contxt = CommentParameter.DepotDataContext; if (IsExist(billNo)) { #region 夏石友,2012-07-13 10:20 S_ScrapBill surBill = serverScrapBill.GetBill(billNo); // 判断当前保存人员是否是建单人 if (surBill.FillInPersonnelCode != bill.FillInPersonnelCode) { error = string.Format("您不是建单人 [{0}, {1}] 无法进行此操作", surBill.FillInPersonnelCode, surBill.FillInPersonnel); return(false); } #endregion //检查总成报废数量是否都设置了流水码 foreach (var item in goodsList) { if (!m_serverProductCode.IsFitCount(item.物品ID, Convert.ToInt32(item.报废数量), bill.Bill_ID)) { error = "请对产品设置流水号,并保证产品数量与流水号数一致"; return(false); } } if (!serverScrapBill.DeleteBill(contxt, billNo, false, out error)) { return(false); } DeleteGoods(contxt, billNo); } if (!serverScrapBill.AddBill(contxt, bill, out error)) { return(false); } AddGoods(contxt, goodsList); contxt.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { if (cmbStorage.Text == "售后库房" && (cmbRKFS.Text == "生产入库" || cmbRKFS.Text == "生产返修入库")) { MessageDialog.ShowPromptMessage("入库方式错误"); return; } if (m_strDJZTFlag == "已确认") { return; } else if (tbsDept.Tag == null) { MessageBox.Show("请选择入库部门", "提示"); tbsDept.Focus(); return; } else if (cmbRKFS.Text == "") { MessageBox.Show("请选择入库方式", "提示"); cmbRKFS.Focus(); return; } DataTable dtTemp = (DataTable)dgv_Main.DataSource; for (int i = 0; i < dtTemp.Rows.Count; i++) { if (!m_serverProductCode.IsFitCount(Convert.ToInt32(dtTemp.Rows[i]["CPID"]), (int)Convert.ToDecimal(dtTemp.Rows[i]["Count"]), m_strDJH)) { MessageBox.Show("请对产品设置流水号,并保证产品数量与流水号数一致", "提示"); return; } } //由于错误录入入库方式,而导致无法重新进行生产入库,经与李剑飞、财务李姝姝沟通后,禁用此功能 Modify by cjb 2019.2.21 //if (cmbRKFS.Text == "生产入库") //{ // m_serverProductCode.IsExistProductStock(txtSellID.Text); //} DataTable dt = (DataTable)dgv_Main.DataSource; m_drZdRK["ID"] = m_intDJID.ToString(); m_drZdRK["DJH"] = txtSellID.Text; m_drZdRK["ObjectDept"] = tbsDept.Tag.ToString(); m_drZdRK["LRRY"] = BasicInfo.LoginID; m_drZdRK["Date"] = ServerTime.Time.ToString(); m_drZdRK["KFRY"] = ""; m_drZdRK["Price"] = Convert.ToDecimal(txtPrice.Text); m_drZdRK["SHRY"] = ""; m_drZdRK["Remark"] = txtRemarkAll.Text; m_drZdRK["YWFS"] = cmbRKFS.Text; m_drZdRK["JYRY"] = ""; m_drZdRK["StorageID"] = UniversalFunction.GetStorageID(cmbStorage.Text); m_drZdRK["LRKS"] = BasicInfo.DeptCode; if (m_findSellIn.UpdateBill(dt, m_drZdRK, CE_MarketingType.入库.ToString(), out m_err)) { MessageBox.Show("保存成功", "提示"); m_billMessageServer.DestroyMessage(txtSellID.Text); m_billMessageServer.SendNewFlowMessage(txtSellID.Text, string.Format("【入库方式】:{0} 【库房】:{1} ※※※ 等待【主管】处理", cmbRKFS.Text, cmbStorage.Text), BillFlowMessage_ReceivedUserType.角色, m_billMessageServer.GetDeptDirectorRoleName(BasicInfo.DeptCode).ToList()); m_intDJID = 1; this.Close(); } else { MessageDialog.ShowErrorMessage(m_err); return; } } catch (Exception ex) { MessageDialog.ShowErrorMessage(ex.Message); return; } }