| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375 |
- using System;
- using System.Collections.Generic;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using Pur.Entity.configureEntity;
- using Core.Mes.Client.Comm.Control;
- using System.Collections;
- using com.hnshituo.pur.vo;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win;
- using Pur.Entity.ck;
- using Core.Mes.Client.Comm.Tool;
- using Pur.configure;
- using Pur.Pop_upWindow;
- using Infragistics.Win.UltraWinGrid;
- using Pur.require_plan;
- using Core.Mes.Client.Comm.Server;
- using Pur.Entity;
- using Pur.PublicTools;
- using com.hnshituo.ck;
- namespace Pur.ck
- {
- public partial class frmCkInBillNewTest : FrmPmsBase
- {
- Hashtable ht = new Hashtable();//存放库区对应的库位
- String strCoustomInfo = "";//若有值,则需单独配置物料接收界面
- public frmCkInBillNewTest()
- {
- InitializeComponent();
- }
- private void frmCkInBillNew_Shown(object sender, System.EventArgs e)
- {
- this.ToolBarItemEnable(this, "conFirmation", true);
- this.ToolBarItemEnable(this, "confirmation1", true);
- this.ToolBarItemEnable(this, "QuitCkRecBill", false);
- }
- private void frmCkInBillNew_Load(object sender, EventArgs e)
- {
- strCoustomInfo = this.CustomInfo == null ? "" : this.CustomInfo.ToString().Trim();
- if (String.IsNullOrEmpty(strCoustomInfo))
- {
- QcreateTime_BeginJL.Value = DateTime.Now.AddMonths(-1);
- QcreateTime_BeginSJ.Value = DateTime.Now.AddMonths(-1);
- }
- else
- {
- QcreateTime_BeginJL.Value = DateTime.Now.AddDays(-3);
- QcreateTime_BeginSJ.Value = DateTime.Now.AddDays(-3);
- }
- QcreateTime_EndJL.Value = DateTime.Now.AddDays(2);
- QcreateTime_BeginJL.Enabled = true;
- QcreateTime_EndJL.Enabled = true;
- ck_createtimeJL.Checked = true;
- QcreateTime_EndSJ.Value = DateTime.Now.AddDays(2);
- QcreateTime_BeginSJ.Enabled = true;
- QcreateTime_EndSJ.Enabled = true;
- ck_createtimeSJ.Checked = true;
- txt_shuttTimeStart_JL.Value = DateTime.Now.AddDays(-3);
- txt_shuttTimeEnd_JL.Value = DateTime.Now.AddDays(1);
- txt_shuttTimeStart_JL.Enabled = false;
- txt_shuttTimeEnd_JL.Enabled = false;
- ck_shutt_JL.Checked = false;
- //初始化加载价格政策
- BalanceBasepriceM pm = new BalanceBasepriceM();
- pm.Flag = "2";
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "doQureyBasePriceM", new object[] { pm });
- cbxJGZC.DataSource = dt;
- cbxJGZC.DisplayMember = "name";
- cbxJGZC.ValueMember = "id";
- PublicPur.InitCellEdit(new UltraGrid[] { GridSubDJL }, new string[] { "Check", "INVPOS", "numException","invPosException", "remarkException","CheckStatu","CheckResult", "KZQTY", "PACKAGEUNIT", "PACKAGEQTY", "ITEMUOMCONEFFICIENT", "JLQTY" });
- QstatusJL.SelectedIndex = 0;
- QstatusSJ.SelectedIndex = 0;
- GridSubDJL.Cursor = Cursors.Default;
- GridSubDSJ.Cursor = Cursors.Default;
- }
- #region toolbar工具栏
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- Get_PUR_EXC_DELIVERY_M("");
- break;
- case "conFirmation"://待检入库
- instock("1");
- break;
- case "confirmation1"://正式入库
- instock("2");
- break;
- case "QuitCkRecBill"://撤销入库
- QuitCkRecBill();
- break;
- case "doExcel"://导出excel
- doExcel();
- break;
- case "doSplit"://拆分送货行
- doSplit();
- break;
- case "ESC":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 查询送货通知单主表
- /// </summary>
- private void Get_PUR_EXC_DELIVERY_M(String strsubId)
- {
- //清空数据
- try
- {
- this.Cursor=Cursors.WaitCursor;
- publicPms.clearOldData(panel_JL, new string[] { });
- publicPms.clearOldData(panel_sj, new string[] { });
- JHY.Clear();
- JLdata.Clear();
- exception.Clear();
- inbill.Clear();
- if(ultraTabControl1.SelectedTab.Key=="2")
- {
- subMJL.Clear();
- subDJL.Clear();
- doQueryM("1", "2", strsubId);
- }
- else if(ultraTabControl1.SelectedTab.Key=="3")
- {
- subMSJ.Clear();
- subDSJ.Clear();
- doQueryM("", "3", strsubId);
- }
- else{
- MessageUtil.ShowTips("未知参数");
- }
- }
- catch(Exception ex)
- {
- MessageUtil.ShowTips("加载数据失败:"+ex.Message);
- }
- finally
- {
- this.Cursor=Cursors.Default;
- }
- }
- /// <summary>
- /// 正式入库单
- /// </summary>
- private void setCkInBllList()
- {
- instock("1");
- }
- /// <summary>
- /// 待检入库
- /// </summary>
- private void setWaitChk_CkInBllList()
- {
- instock("2");
- }
- /// <summary>
- /// 撤销入库
- /// </summary>
- private void QuitCkRecBill()
- {
- UltraGrid ug = null;
- if (ultraTabControl1.SelectedTab.Key == "3")//计量
- {
- ug = GridSubDSJ;
- }
- else
- {
- MessageUtil.ShowTips("请选择需撤销入库的实绩");
- return;
- }
- ug.UpdateData();
- if (ug.Rows.Count <= 0)
- {
- MessageUtil.ShowTips("无可操作送货单行");
- return;
- }
- ArrayList aledsc = new ArrayList();
- ExcDeliverySubC edsc1 = new ExcDeliverySubC();
- ExcDeliverySubM edsM = new ExcDeliverySubM();
- foreach (UltraGridRow ugr in ug.Rows)
- {
- if (ugr.Hidden || !(bool)ugr.Cells["Check"].Value)
- { continue; }
- ExcDeliverySubC edsc = new ExcDeliverySubC();
- String strSubSqe = ugr.Cells["DeliverySubLineSqe"].Value.ToString().Trim();
- edsc.DeliverySubLineSqe = strSubSqe;
- if (!testDeliveryStatus(strSubSqe, 3, ref edsc1,ref edsM))
- {
- return;
- }
- edsc.UpdateName = UserInfo.GetUserName();
- edsc.UpdateUserid = UserInfo.GetUserID();
- edsc.UpdateTime = DateTime.Now;
- aledsc.Add(edsc);
- }
- if (aledsc.Count <= 0)
- {
- MessageUtil.ShowTips("请勾选送货单");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("确定撤销勾选的" + aledsc.Count + "条送货单行的入库记录?") == DialogResult.No)
- {
- return;
- }
- CoreResult crt = this.GetJsonService().execute<CoreResult>("com.hnshituo.pur.ck.service.CkInBillService", "QuitCkRecBill", new object[] { aledsc,strCoustomInfo});
- if (crt.Resultcode != 0)
- {
- MessageUtil.ShowTips("撤销入库失败 " + crt.Resultmsg);
- return;
- }
- MessageUtil.ShowTips("撤销入库成功");
- //循环判断此送货单是否全部收货,全部收货则关闭收货单
- Get_PUR_EXC_DELIVERY_M("");
- }
- /// <summary>
- /// 导出Excel
- /// </summary>
- private void doExcel()
- {
- try
- {
- this.Cursor = Cursors.Default;
- if (ultraTabControl1.SelectedTab.Key == "2")
- {
- if (GridSubDJL.Rows.Count <= 0)
- {
- MessageUtil.ShowTips("无可导出明细!");
- return;
- }
- ArrayList alUltraGrid = new ArrayList();
- alUltraGrid.Add(GridSubDJL);
- ArrayList alSheeft = new ArrayList();
- alSheeft.Add("计量待入库明细");
- GridHelper.ulGridToExcel(alUltraGrid, alSheeft, "计量待入库明细");
- }
- else
- {
- if (GridSubDSJ.Rows.Count <= 0)
- {
- MessageUtil.ShowTips("无可导出明细!");
- return;
- }
- ArrayList alUltraGrid = new ArrayList();
- alUltraGrid.Add(GridSubDSJ);
- ArrayList alSheeft = new ArrayList();
- alSheeft.Add("已入库明细");
- GridHelper.ulGridToExcel(alUltraGrid, alSheeft, "已入库明细");
- }
- }
- catch (Exception e)
- {
- MessageUtil.ShowTips("导出失败" + e.Message);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private DateTime setCreateTimeStart(Object value)
- {
- DateTime time = Convert.ToDateTime(value);
- DateTime endtime = new DateTime(time.Year, time.Month, time.Day, 0, 0, 0);
- return endtime;
- }
- private DateTime setCreateTimeEnd(Object value) {
- DateTime time = Convert.ToDateTime(value);
- DateTime endtime = new DateTime(time.Year, time.Month, time.Day,23,59,59);
- return endtime;
- }
- #endregion
- private void doSplit()
- {
- double QtyUse = 0;
- ArrayList list = new ArrayList();
- foreach (UltraGridRow ugr2 in GridJL_JL.Rows)
- {
- ExcDeliverySubC subc = new ExcDeliverySubC();
- subc.Qty = Math.Round(double.Parse("1"), 3);
- subc.Matchid = ugr2.Cells["matchid"].Value.ToString();
- QtyUse = QtyUse + (double)subc.Qty;
- list.Add(subc);
- }
- if (MessageUtil.ShowYesNoAndQuestion("确定拆分送货单行") == DialogResult.No)
- {
- return;
- }
- ExcDeliverySubC subcNew = new ExcDeliverySubC();
- subcNew.DeliverySubLineSqe = GridSubMJL.ActiveRow.Cells["DELIVERYSUBID"].Value.ToString2() + "001";
- subcNew.CreateUserid = UserInfo.GetUserID();
- subcNew.CreateTime = DateTime.Now;
- subcNew.CreateName = UserInfo.GetUserName();
- CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.ck.service.ExcDeliverySubCService", "doSplit", new object[] { list, subcNew });
- if (rt.Resultcode != 0)
- {
- MessageUtil.ShowTips("操作失败:" + rt.Resultmsg);
- return;
- }
- else
- {
- getCheckdSubMCol(GridSubMJL, "2");
- MessageUtil.ShowTips("操作成功");
- return;
- }
- }
- private void GridSubMJL_CellChange(object sender, CellEventArgs e)
- {
- if (e.Cell.Column.Key == "CHK")
- {
- UltraGridRow chkRow = e.Cell.Row;
- foreach (UltraGridRow row in GridSubMJL.Rows)
- {
- if (row.Cells["Chk"].Value.ToString() == "True" && row != chkRow)
- {
- row.Cells["Chk"].Value = "False";
- row.Update();
- }
- }
- getCheckdSubMCol(GridSubMJL, "2");
- }
- }
- private void GridSubMSJ_CellChange(object sender, CellEventArgs e)
- {
- if (e.Cell.Column.Key == "CHK")
- {
- getCheckdSubMCol(GridSubMSJ, "3");
- }
- }
- /// <summary>
- /// 计量grid
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void GridSubDJL_CellChange(object sender, CellEventArgs e)
- {
- GridSubDJL.UpdateData();
- UltraGridRow ugr = e.Cell.Row;
- if (e.Cell.Column.Key == "CheckStatu")//选择判定结果
- {
- if (e.Cell.Value.ToString() == "0")
- {
- setCellColor(ugr, System.Drawing.Color.FromArgb(255, 255, 128), "InvPosException", "RemarkException", "CheckStatu", "KZQTY", "PACKAGEUNIT", "PACKAGEQTY", "ITEMUOMCONEFFICIENT", "JLQTY");
- //ugr.Cells["INNUM"].Value = 0;//入库量=收货量
- //ugr.Cells["numException"].Value = ugr.Cells["SHIPQTY"].Value;//待处置量
- getJlInNum(ugr);
- }
- else
- {
- setCellColor(ugr, System.Drawing.Color.FromArgb(255, 255, 128), "INVPOS", "CheckStatu", "KZQTY", "PACKAGEUNIT", "PACKAGEQTY", "ITEMUOMCONEFFICIENT", "JLQTY");
- //ugr.Cells["INNUM"].Value = ugr.Cells["SHIPQTY"].Value;//入库量=收货量
- //ugr.Cells["numException"].Value = 0;//待处置量
- getJlInNum(ugr);
- }
- }
- if (e.Cell.Column.Key == "KZQTY" || e.Cell.Column.Key == "ITEMUOMCONEFFICIENT" || e.Cell.Column.Key == "JLQTY")//口杂
- {
- if (e.Cell.Column.Key == "JLQTY")
- {
- ugr.Cells["SHIPQTY"].Value = ugr.Cells["JLQTY"].Value;
- }
- getJlInNum(ugr);
- }
- if (e.Cell.Column.Key == "PACKAGEQTY")
- {
- getInNum(ugr, "1");
- }
- if (e.Cell.Column.Key == "INVPOS")//选择储位
- {
- GridSubDJL.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
- //comm.RefreshAndAutoSizeExceptColumns(ultraGrid1);
- }
-
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void GridJL_CellChange(object sender, CellEventArgs e)
- {
- //匹配的料型是否一致
- if (e.Cell.Column.Key == "Check")
- foreach (UltraGridRow ugr2 in GridJL_JL.Rows)
- {
- if ((bool)ugr2.Cells["Check"].Value)
- {
- if (e.Cell.Row.Cells["materielRule"].Value.ToString() == ugr2.Cells["materielRule"].Value.ToString() && e.Cell.Row != ugr2)
- {
- comm.ConfirmOption("勾选匹配的计量料型必须一致");
- e.Cell.Row.Cells["Check"].Value = false;
- return;
- }
- }
- }
- }
- private void ck_createtimeJL_CheckedChanged(object sender, System.EventArgs e)
- {
- QcreateTime_BeginJL.Enabled = ck_createtimeJL.Checked;
- QcreateTime_EndJL.Enabled = ck_createtimeJL.Checked;
- }
- private void ck_createtimeSJ_CheckedChanged(object sender, System.EventArgs e)
- {
- QcreateTime_BeginSJ.Enabled = ck_createtimeSJ.Checked;
- QcreateTime_EndSJ.Enabled = ck_createtimeSJ.Checked;
- }
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- publicPms.clearOldData(panel_sj, new string[] { });
- publicPms.clearOldData(panel_JL, new string[] { });
- JHY.Clear();
- JLdata.Clear();
- exception.Clear();
- if (ultraTabControl1.SelectedTab.Key == "1" || ultraTabControl1.SelectedTab.Key == "2")
- {
- this.ToolBarItemEnable(this, "conFirmation", true);
- this.ToolBarItemEnable(this, "confirmation1", true);
- this.ToolBarItemEnable(this, "QuitCkRecBill", false);
- }
- else
- {
- this.ToolBarItemEnable(this, "conFirmation", false);
- this.ToolBarItemEnable(this, "confirmation1", false);
- this.ToolBarItemEnable(this, "QuitCkRecBill", true);
- }
- }
- private void GridSubMSJ_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
- {
- if (e.Column.Key == "CHK")
- {
- getCheckdSubMCol(GridSubMSJ, "3");
- }
- }
- private void GridSubMJL_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
- {
- if (e.Column.Key == "CHK")
- {
- getCheckdSubMCol(GridSubMJL, "2");
- }
- }
- #region 行按钮
- /// <summary>
- /// 计量信息筛选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btn_JL_select_Click(object sender, System.EventArgs e)
- {
- UltraGridRow ugr = GridSubDJL.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowTips("请选择一个送货单的物料");
- return;
- }
- String sordSqe = ugr.GetCellValue("ORDERLINESQE").ToString().Trim();
- ArrayList list1 = new ArrayList();
- list1.Add(sordSqe);
- DataTable dtjl = getJLData((string[])list1.ToArray(typeof(string)));
- if (dtjl != null && dtjl.Rows.Count > 0)
- {
- GridHelper.CopyDataToDatatable(dtjl, DTJL, true);
- GridHelper.RefreshAndAutoSize(GridJHY_JL);
- }
-
- }
- /// <summary>
- /// 单个匹配送货单行
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btn_JL_sure_Click(object sender, System.EventArgs e)
- {
- if (ultraTabControl1.SelectedTab.Key != "2")
- {
- MessageUtil.ShowTips("请选择计量入库界面");
- return;
- }
- UltraGridRow ugr1 = GridSubDJL.ActiveRow;
- if (ugr1 == null)
- {
- MessageUtil.ShowTips("请选择需匹配的送货单行");
- return;
- }
- UltraGridRow ugr2 = GridJL_JL.ActiveRow;
- if (ugr2 == null)
- {
- MessageUtil.ShowTips("请选择进行匹配的磅单");
- return;
- }
- String strSubSqe = ugr1.GetCellValue("DELIVERYSUBLINESQE").ToString().Trim();
- double numJLQTY = 0;
- double numTARE = 0;//皮重
- double numGROSS = 0; //毛重
- string strSUTTLETIME = "";//计量时间
- String strMaterielRule = "";
- double numKZQTY = 0;
- double b_txt_deduction2 = 0.00;//扣机铁
- double b_txt_deduction3 = 0.00;//扣超长
- double b_txt_deduction4 = 0.00;//扣轻薄
- Double.TryParse(ugr2.Cells["suttle"].Value.ToString().Trim(), out numJLQTY);
- Double.TryParse(ugr2.Cells["deduction"].Value.ToString().Trim(), out numKZQTY);
- Double.TryParse(ugr2.Cells["deduction2"].Value.ToString().Trim(), out b_txt_deduction2);//扣机铁
- Double.TryParse(ugr2.Cells["deduction3"].Value.ToString().Trim(), out b_txt_deduction3);//扣超长
- Double.TryParse(ugr2.Cells["deduction4"].Value.ToString().Trim(), out b_txt_deduction4);//扣轻薄
- Double.TryParse(ugr2.Cells["TARE"].Value.ToString().Trim(), out numTARE);//皮重
- Double.TryParse(ugr2.Cells["GROSS"].Value.ToString().Trim(), out numGROSS);//毛重
- string strmatchid = ugr2.Cells["matchid"].Value.ToString().Trim();//绑单号
- strMaterielRule = ugr2.Cells["materielRule"].Value.ToString().Trim();//废钢料型
- strSUTTLETIME = ugr2.Cells["SUTTLETIME"].Value.ToString().Trim();//计量时间
- int i = 0;
- String strSubSqe2 = "";
- foreach (UltraGridRow row in GridSubDJL.Rows)
- {
- if (row.GetCellValue("DELIVERYSUBLINESQE").ToString().Trim() != strSubSqe || row.GetCellValue("matchid").ToString().Trim() == "strmatchid")
- {
- strSubSqe2 = row.GetCellValue("DELIVERYSUBLINESQE").ToString().Trim();
- i = i + 1;
- }
- }
- if (i >= 1)
- {
- if (MessageUtil.ShowYesNoAndQuestion("送货单行:" + strSubSqe2 + "已绑定该磅单,确定重复绑定?") != DialogResult.Yes)
- {
- return;
- }
- }
- ugr1.Cells["JLQTY"].Value = numJLQTY;//净重
- ugr1.Cells["KZQTY"].Value = numKZQTY;//净扣杂
- ugr1.Cells["deduction2"].Value = b_txt_deduction2;//扣机铁
- ugr1.Cells["deduction3"].Value = b_txt_deduction3;//扣超长
- ugr1.Cells["deduction4"].Value = b_txt_deduction4;//扣轻薄
- ugr1.Cells["TARE"].Value = numTARE;//皮重
- ugr1.Cells["GROSS"].Value = numGROSS;//毛重
- ugr1.Cells["SUTTLETIME"].Value = strSUTTLETIME;//计量时间
- ugr1.Cells["CheckResult"].Value = strMaterielRule;//废钢料型
- ugr1.Cells["matchid"].Value = strmatchid;//绑单号
- GridSubDJL.UpdateData();
- }
- /// <summary>
- /// 批量确定
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btn_JL_sure_all_Click(object sender, System.EventArgs e)
- {
- bindJLItems();
- }
- private void ck_shutt_JL_CheckedChanged(object sender, System.EventArgs e)
- {
- txt_shuttTimeStart_JL.Enabled = ck_shutt_JL.Checked;
- txt_shuttTimeEnd_JL.Enabled = ck_shutt_JL.Checked;
- }
- #endregion
- #region 公共方法
- /// <summary>
- /// 查询方法
- /// </summary>
- /// <param name="strIsMeter">是否计量</param>
- /// <param name="tab">加载数据页面</param>
- /// <param name="subId">是否激活</param>
- private void doQueryM(String strIsMeter,String tab,String subId)
- {
- //ht.Clear();
- //ht_CheckStatu.Clear();
- Hashtable map = new Hashtable();
- if (tab == "2")
- {
- map.Clear();
- map.Add("deliverySubId", QsubIdJL.Text.Trim());
- map.Add("suppName", QsuppNameJL.Text.Trim());
- map.Add("orderId", QorderIdJL.Text);
- map.Add("invPhysicName", QInphysicJL.Text.Trim());
- map.Add("deliveryLocation", QLocationJL.Text.Trim());
- if (String.IsNullOrEmpty(strCoustomInfo))
- {
- map.Add("statusRK", QstatusJL.Value == null ? "" : QstatusJL.Value.ToString().Trim());
- }
- else
- {
- map.Add("statusEx", QstatusJL.Value == null ? "" : QstatusJL.Value.ToString().Trim());
- map.Add("itemCodeEx", strCoustomInfo);
- }
- if (ck_createtimeJL.Checked)
- {
- if (QcreateTime_BeginJL.Value != null)//创建开始时间
- {
- map.Add("createTimeBegin", setCreateTimeStart(QcreateTime_BeginJL.Value));
- }
- if (QcreateTime_EndJL.Value != null)//创建结束时间
- {
- map.Add("createTimeEnd", setCreateTimeEnd(QcreateTime_EndJL.Value));
- }
- }
- }
- else if (tab == "3")
- {
- map.Clear();
- map.Add("deliverySubId", QsubIdSJ.Text.Trim());
- map.Add("suppName", QsuppNameSJ.Text.Trim());
- map.Add("orderId", QorderIdSJ.Text);
- map.Add("invPhysicName", QInphysicSJ.Text.Trim());
- map.Add("deliveryLocation", QLocationSJ.Text.Trim());
- if (String.IsNullOrEmpty(strCoustomInfo))
- {
- map.Add("statusRK", QstatusSJ.Value == null ? "" : QstatusSJ.Value.ToString().Trim());
- }
- else
- {
- map.Add("statusEx", QstatusSJ.Value == null ? "" : QstatusSJ.Value.ToString().Trim());
- map.Add("itemCodeEx", strCoustomInfo);
- }
- if (ck_createtimeSJ.Checked)
- {
- if (QcreateTime_BeginSJ.Value != null)//创建开始时间
- {
- map.Add("createTimeBegin", setCreateTimeStart(QcreateTime_BeginJL.Value));
- }
- if (QcreateTime_EndSJ.Value != null)//创建结束时间
- {
- map.Add("createTimeEnd", setCreateTimeEnd(QcreateTime_EndJL.Value));
- }
- }
- }
- else
- {
- MessageUtil.ShowTips("未知页面");
- }
- map.Add("meteringFlag", strIsMeter);
- DataTable dt = this.GetJsonService().execute<DataTable>("com.hnshituo.pur.ck.service.ExcDeliverySubMService", "doQueryDeliverySubMList", new object[] { map });
- if (dt != null && dt.Rows.Count > 0)
- {
- if (tab == "2")
- {
- GridHelper.CopyDataToDatatable(dt, DTsubMJL, true);
- GridHelper.RefreshAndAutoSize(GridSubMJL);
- if (String.IsNullOrEmpty(subId))
- {
- publicPms.doActiveSelRow(GridSubMJL, "DELIVERYSUBID", subId);
- }
- }
- else if (tab == "3")
- {
- GridHelper.CopyDataToDatatable(dt, DTsubMSJ, true);
- GridHelper.RefreshAndAutoSize(GridSubMSJ);
- if (String.IsNullOrEmpty(subId))
- {
- publicPms.doActiveSelRow(GridSubMSJ, "DELIVERYSUBID", subId);
- }
- }
- else
- {
- MessageUtil.ShowTips("未知页面");
- }
- }
- }
- //public static List<UltraGridRow> UltraGridGetChooseRows(UltraGrid grid, string columnName = "CHK")
- //{
- // grid.UpdateData();
- // List<UltraGridRow> list = new List<UltraGridRow>();
- // RowsCollection rows = grid.Rows;
- // foreach (var item in rows)
- // {
- // try
- // {
- // if (Convert.ToBoolean(item.Cells[columnName].Value) == true && item.Hidden == false && item.IsFilteredOut == false)
- // {
- // list.Add(item);
- // }
- // }
- // catch { }
- // }
- // return list;
- //}
- private void getCheckdSubMCol(UltraGrid grid, String tab)
- {
- try
- {
- IQueryable<UltraGridRow> uGridss = null;
- this.Cursor = Cursors.WaitCursor;
- grid.UpdateData();
- ExcDeliverySubC edsc = new ExcDeliverySubC();
- List<string> l = new List<string>();
- // List<UltraGridRow> list= UltraGridGetChooseRows(grid);
- if(tab=="2"){
- uGridss = GridSubMJL.Rows.AsQueryable().Where(" CHK = 'True'");
- }else if(tab=="3"){
- uGridss = GridSubMSJ.Rows.AsQueryable().Where(" CHK = 'True'");
- }
- //获取库区库位
- foreach (UltraGridRow ugr in uGridss)
- {
- String strDeliverySubId = ugr.GetCellValue("DeliverySubId").ToString().Trim();
- if (tab != "3")
- {
- String strInvPhysic = ugr.GetCellValue("invPhysic").ToString().Trim();
- String strInvPhysicName = ugr.GetCellValue("InvPhysicName").ToString().Trim();
- if (String.IsNullOrEmpty(strInvPhysic) || String.IsNullOrEmpty(strInvPhysicName))
- {
- MessageUtil.ShowTips("送货单:" + strDeliverySubId + "交付地址未绑定库区,无法办理入库,请维护库区和地址挂接关系基础数据,请注意");
- ugr.Cells["CHK"].Value = false;
- ugr.Cells["CHK"].Activation = Activation.Disabled;
- ugr.Appearance.BackColor = Color.WhiteSmoke;
- continue;
- }
- if (!ht.ContainsKey(strInvPhysic))
- {
- DataTable tt = getInvPosdt(strInvPhysic);
- if (tt == null || tt.Rows.Count <= 0)
- {
- ugr.Cells["CHK"].Value = false;
- ugr.Cells["CHK"].Activation = Activation.Disabled;
- ugr.Appearance.BackColor = Color.WhiteSmoke;
- MessageUtil.ShowTips("送货单:" + strDeliverySubId + "对应的库区:" + strInvPhysicName + "无入库储位,无法办理入库,请维护库区和储位挂接关系基础数据,请注意");
- continue;
- }
- ht.Add(strInvPhysic, tt);
- }
- }
- l.Add(strDeliverySubId);
-
- }
- if (l.Count >= 1)
- {
- edsc.Col = l.ToArray();
- Get_PUR_EXC_DELIVERY_C(edsc, tab);
- }
- }
- catch (Exception ex)
- {
- MessageUtil.ShowTips("加载送货单行失败:" + ex.Message);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- /// <summary>
- /// 查询送货通知单行表
- /// </summary>
- private void Get_PUR_EXC_DELIVERY_C(ExcDeliverySubC EdC, string tab)
- {
-
- JHY.Clear();
- JLdata.Clear();
- exception.Clear();
- JHY.Clear();
- if(tab=="2")//过磅
- {
- publicPms.clearOldData(panel_JL, new string[] { });
- DTsubDJL.Rows.Clear();
- JLdata.Clear();
- EdC.MeteringFlag = "1";
- if (String.IsNullOrEmpty(strCoustomInfo))
- {
- EdC.Status = QstatusJL.Value == null ? "" : QstatusJL.Value.ToString().Trim();
- }
- else
- {
- EdC.UpdateUserid = QstatusJL.Value == null ? "" : QstatusJL.Value.ToString().Trim();
- EdC.ItemCode = strCoustomInfo;
- }
- }
- else if (tab == "3")//实绩
- {
- publicPms.clearOldData(panel_sj, new string[] { });
- DTsubDSJ.Rows.Clear();
- if (String.IsNullOrEmpty(strCoustomInfo))
- {
- EdC.Status = QstatusSJ.Value == null ? "" : QstatusSJ.Value.ToString().Trim();
- }
- else
- {
- EdC.UpdateUserid = QstatusSJ.Value == null ? "" : QstatusSJ.Value.ToString().Trim();
- EdC.ItemCode = strCoustomInfo;
- }
- }
- else
- {
- MessageUtil.ShowTips("页面参数错误");
- return;
- }
- EdC.Validflag = "1";
- DataTable dt = this.GetJsonService().execute<DataTable>("com.hnshituo.pur.ck.service.ExcDeliverySubCService", "Query_C", new object[] { EdC });
- EdC.UpdateUserid = strCoustomInfo;
- if (tab == "2")//过磅
- {
- GridHelper.CopyDataToDatatable(dt, DTsubDJL, true);
-
- foreach (UltraGridRow ugr in GridSubDJL.Rows)//过磅
- {
- ugr.Cells["Check"].Value = true;
- ugr.Cells["CheckStatu"].Value = "1";//判定结果默认为合格
- bindDropDown(ugr);//绑定库位
- }
- bindCheckItems(DTsubDJL);//绑定检化验结果
- bindJLItems();//绑定计量结果
- bindPrice();//绑定含税,不含税价格
- foreach (UltraGridRow ugr in GridSubDJL.Rows)//过磅
- {
- getJlInNum(ugr);//自动计算入库量
- //queryCountInNum(ugr);//查询当月累入
- }
- GridSubDJL.UpdateData();
- //设置可编辑的行
- GridHelper.RefreshAndAutoSize(GridSubDJL);
- }
- else
- {
- GridHelper.CopyDataToDatatable(dt, DTsubDSJ, true);
- foreach (UltraGridRow ugr in GridSubDSJ.Rows)//实绩
- {
- getInNum(ugr, "1");
- }
- GridHelper.RefreshAndAutoSize(GridSubDSJ);
-
- }
- }
- //查询当月累入
- //private void queryCountInNum(UltraGridRow ugr) {
- // if (ugr == null)
- // { return; }
- // Hashtable map = new Hashtable();
- // String supCode = ugr.Cells["SUPPCODE"].Value.ToString();
- // String checkResult = ugr.Cells["CheckResult"].Value.ToString();
- // map.Add("supCode", supCode);
- // map.Add("CheckResult", checkResult);
- // DataTable dt = this.GetJsonService().execute<DataTable>("com.hnshituo.pur.ck.service.ExcDeliverySubCService", "Query_C", new object[] { map });
- //}
- /// <summary>
- /// 入库送货单行状态校验
- /// </summary>
- /// <param name="deliverySubId"></param>
- /// <param name="p"></param>
- /// <returns></returns>
- private bool testDeliveryStatus(String deliverySubId, int p, ref ExcDeliverySubC subc, ref ExcDeliverySubM subM)
- {
- if (String.IsNullOrEmpty(deliverySubId))
- {
- MessageUtil.ShowTips("送货单行号为空,无法校验数据有效性");
- return false;
- }
- subc = this.GetJsonService().execute<ExcDeliverySubC>("com.hnshituo.pur.ck.service.ExcDeliverySubCService", "findById", new object[] { deliverySubId });
- if (subc == null)
- {
- MessageUtil.ShowTips("未发现送货单行:" + deliverySubId + " 信息记录,可能已作废,或请刷新界面重试");
- return false;
- }
- if (subc.Validflag != "1")
- {
- MessageUtil.ShowTips("未发现送货单行:" + deliverySubId + " 信息记录,可能已作废,或请刷新界面重试");
- return false;
- }
- String testStatus = subc.Status;
- if (String.IsNullOrEmpty(subc.DeliverySubId))
- {
- MessageUtil.ShowTips("未找到送货单行的头信息");
- return false;
- }
- subM = this.GetJsonService().execute<ExcDeliverySubM>("com.hnshituo.pur.ck.service.ExcDeliverySubMService", "findById", new object[] { subc.DeliverySubId });
- if (subM == null)
- {
- MessageUtil.ShowTips("未发现送货单:" + subc.DeliverySubId + " 信息记录,可能已作废,或请刷新界面重试");
- return false;
- }
- if (subM.Validflag != "1")
- {
- MessageUtil.ShowTips("未发现送货单:" + subc.DeliverySubId + " 信息记录,可能已作废,或请刷新界面重试");
- return false;
- }
- //待检入库
- if (p == 1)
- {
- if (subM.ReceiveType == "110107")//JIT
- {
- if (testStatus != "3")
- {
- MessageUtil.ShowTips("送货单行:" + deliverySubId + " 为JIT入库,可能还未完成复检,或请刷新界面重试");
- return false;
- }
- }
- else if (subM.ReceiveType == "110101")
- {
- if (testStatus != "2")
- {
- MessageUtil.ShowTips("送货单行:" + deliverySubId + " 为非JIT,可能还未完成初检,或请刷新界面重试");
- return false;
- }
- }
- if (subc.MeteringFlag == "1")
- {
- if (subc.Ismeter == "0")
- {
- MessageUtil.ShowTips("物料:" + subc.ItemName + " 为计重物料,请先计量");
- return false;
- }
- }
- if (subc.PcFlag == "1")
- {
- if (String.IsNullOrEmpty(subc.CheckNo))
- {
- MessageUtil.ShowTips("物料:" + subc.ItemName + " 为检化验物料,请生成检化验委托并做好取样和检验准备");
- return false;
- }
- }
- }
- //正式入库
- else if (p == 2)
- {
- if (subM.ReceiveType == "110107")//JIT
- {
- if (testStatus != "3"&&testStatus != "4")
- {
- MessageUtil.ShowTips("送货单行:" + deliverySubId + " 为JIT入库,还未复检或者待检,或请刷新界面重试");
- return false;
- }
- }
- else if (subM.ReceiveType == "110101")
- {
- if (testStatus != "2" && testStatus != "4")
- {
- MessageUtil.ShowTips("送货单行:" + deliverySubId + " 为非JIT,可能还未初检或待检,或请刷新界面重试");
- return false;
- }
- }
- if (subc.MeteringFlag == "1")
- {
- if (subc.Ismeter == "0")
- {
- MessageUtil.ShowTips("物料:" + subc.ItemName + " 为计重物料,请先计量");
- return false;
- }
- }
- if (subc.PcFlag == "1")
- {
- if (String.IsNullOrEmpty(subc.CheckNo))
- {
- MessageUtil.ShowTips("物料:" + subc.ItemName + " 为检化验物料,请生成检化验委托并做好取样和检验准备");
- return false;
- }
- }
- }
- //正式入库(废钢)
- else if (p == 4)
- {
- if (testStatus != "1" && testStatus != "2" && testStatus != "3" && testStatus != "4")
- {
- MessageUtil.ShowTips("送货单行:" + deliverySubId + " 已入库,或请刷新界面重试");
- return false;
- }
- if (subc.MeteringFlag == "1")
- {
- //if (subc.Ismeter == "0")
- //{
- // MessageUtil.ShowTips("物料:" + subc.ItemName + " 为计重物料,请先计量");
- // return false;
- //}
- }
- if (subc.PcFlag == "1")
- {
- if (String.IsNullOrEmpty(subc.CheckNo))
- {
- MessageUtil.ShowTips("物料:" + subc.ItemName + " 为检化验物料,请生成检化验委托并做好取样和检验准备");
- return false;
- }
- }
- }
- //撤销入库
- else if (p == 3)
- {
- if (testStatus != "5" && testStatus != "4")
- {
- MessageUtil.ShowTips("送货单行:" + deliverySubId + " 还未入库或者已结算,或请刷新界面重试");
- return false;
- }
- }
- else
- {
- MessageUtil.ShowTips("未知参数:" + p);
- return false;
- }
- return true;
- }
- /// <summary>
- /// 获取库区库库位数据
- /// </summary>
- /// <param name="strPhysic"></param>
- /// <returns></returns>
- private DataTable getInvPosdt(string strPhysic)
- {
- string strInvPhysic = strPhysic;
- ActualSeatPosEntity PosEntity = new ActualSeatPosEntity();
- PosEntity.Validflag = "1";
- PosEntity.InvPhysic = strInvPhysic;
- DataTable dt = this.GetJsonService().execute<DataTable>("com.hnshituo.pur.configure.service.ActualSeatPosService", "find", new object[] { PosEntity, 0, 0 });
- return dt;
- }
- /// <summary>
- /// 绑定当前行的库位,绑定判定结果下拉列表数据源(储位和判断等级)
- /// </summary>
- private void bindDropDown(UltraGridRow ugr)
- {
- try
- {
- //绑定储位
- if (ugr.Cells["INVPOS"].EditorComponent == null || ugr.Cells["InvPosException"].EditorComponent == null)
- {
- String strInvphysic = ugr.Cells["DELETEUSERID"].Value.ToString().Trim();
- if (!String.IsNullOrEmpty(strInvphysic))
- {
- DataTable dt = null;
- if (ht[strInvphysic] != null)
- {
- dt = (DataTable)ht[strInvphysic];
- }
- if (ugr.Cells["INVPOS"].EditorComponent == null)
- {
- UltraComboEditor ucbe = getNewUltraComboEditor();
- comm.setUltraComboEditorBind(ucbe, dt, "invPosName", "invPos");
- ugr.Cells["INVPOS"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- ugr.Cells["INVPOS"].EditorComponent = ucbe;
- if (dt.Rows.Count > 0 && ugr.Cells["INVPOS"].Value.ToString() == "")
- {
- ugr.Cells["INVPOS"].Value = dt.Rows[0]["invPos"].ToString();
- }
- }
- if (ugr.Cells["InvPosException"].EditorComponent == null)
- {
- //待处置库位
- UltraComboEditor ucbe1 = getNewUltraComboEditor();
- comm.setUltraComboEditorBind(ucbe1, dt, "invPosName", "invPos");
- ugr.Cells["InvPosException"].EditorComponent = ucbe1;
- ugr.Cells["InvPosException"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- }
- }
- }
- //绑定判定结果
- ugr.Cells["CheckStatu"].EditorComponent = cmbCheck;
- }
- catch (System.Exception ex)
- {
- MessageUtil.ShowTips("加载送货单行:" + ugr.GetCellValue("DELIVERYSUBLINESQE") + "入库可选储位和可判定等级失败:" + ex.Message);
- ugr.Cells["Check"].Value = false;
- ugr.Cells["Check"].Activation = Activation.Disabled;
- ugr.Appearance.BackColor = Color.WhiteSmoke;
- }
- }
- /// <summary>
- /// 批量绑定检化验结果
- /// </summary>
- private void bindCheckItems(DataTable dtsub)
- {
- ArrayList al = comm.getDtGroupBy_reAl(dtsub, "CHECKNO");
- for (int i = 0; i < al.Count; )
- {
- if (al[i] == null)
- {
- al.RemoveAt(i);
- }
- else
- {
- i++;
- }
- }
- if (al.Count == 0)
- {
- return;
- }
- CheckconsignBaseinfo cb = new CheckconsignBaseinfo();
- cb.CheckNos = (string[])al.ToArray(typeof(string));
- DataTable dt = this.GetJsonService().execute<DataTable>("com.hnshituo.pur.jhy.service.CheckconsignBaseinfo_jhyService", "doQuery_Baseinfo", new object[] { cb });
- //DataTable dt = this.GetJsonService().execute<DataTable>("com.hnshituo.pur.utils.service.UtilsService", "readData1", new object[] { cb });
- if (dt == null || dt.Rows.Count <= 0)
- {
- return;
- }
- for (int i = 0; i < dtsub.Rows.Count; i++)
- {
- DataRow dr = dtsub.Rows[i];
- foreach (DataRow dr1 in dt.Rows)
- {
- if (dr["CHECKNO"].ToString() == dr1["CHECKNO"].ToString())
- {
- dr["CHECKUSERNAME"] = dr1["JUDGENAME"];//判断人
- dr["CHECKDATE"] = dr1["JUDGETIME"];//判断人
- //判定结果
- if (dr1["judgelevelcode"].ToString() == "" || dr1["judgelevelcode"].ToString() == "无")
- {
- if (dr1["judgelevelcode"].ToString() == "1")
- {
- dr["CheckStatu"] = "1";
- }
- else if (dr1["judgelevelcode"].ToString() == "0")
- {
- dr["CheckStatu"] = "0";
- }
- else
- {
- dr["CheckStatu"] = "1";
- }
- }
- break;
- }
- }
- }
- }
- /// <summary>
- /// 批量绑定计量结果
- /// </summary>
- private void bindJLItems()
- {
- if (ultraTabControl1.SelectedTab.Key != "2")
- {
- MessageUtil.ShowTips("请选择计量入库界面");
- return;
- }
- double numJLQTY = 0;
- double numTARE = 0;//皮重
- double numGROSS = 0; //毛重
- string strSUTTLETIME = "";//计量时间
- String strMaterielRule = "";
- double numKZQTY = 0;
- double b_txt_deduction2 = 0.00;//扣机铁
- double b_txt_deduction3 = 0.00;//扣超长
- double b_txt_deduction4 = 0.00;//扣轻薄
- ArrayList al = comm.getDtGroupBy_reAl(DTsubDJL, "ORDERLINESQE");
- for (int i = 0; i < al.Count; )
- {
- if (al[i] == null)
- {
- al.RemoveAt(i);
- }
- else
- {
- i++;
- }
- }
- if (al.Count == 0)
- {
- return;
- }
- Hashtable ht = new Hashtable();
- ht.Add("ordernos", (string[])al.ToArray(typeof(string)));
- ht.Add("updateUserid", "5");
- DataTable subc = this.execute<DataTable>("com.hnshituo.pur.ck.service.ExcDeliverySubCService", "Query_C", new object[] { ht });
- ArrayList matchids = new ArrayList();
- for (int i = 0; i < subc.Rows.Count; i++)
- {
- matchids.Add(subc.Rows[i]["MATCHID"].ToString2());
- }
- if (matchids.Count > 0)
- {
- ht.Add("matchidsnNotIn", (string[])matchids.ToArray(typeof(string)));
- }
- DataTable dt = this.GetJsonService().execute<DataTable>("com.hnshituo.pur.utils.service.UtilsService", "readData", new object[] { ht });
- if (dt == null || dt.Rows.Count <= 0)
- {
- return;
- }
- foreach (UltraGridRow row in GridSubDJL.Rows)
- {
- String strORDERLINESQE = row.GetCellValue("matchid").ToString().Trim();
- foreach (DataRow dr1 in dt.Rows)
- {
- if (strORDERLINESQE == dr1["matchid"].ToString())
- {
- Double.TryParse(dr1["suttle"].ToString().Trim(), out numJLQTY);
- Double.TryParse(dr1["deduction"].ToString().Trim(), out numKZQTY);
- Double.TryParse(dr1["deduction2"].ToString().Trim(), out b_txt_deduction2);//扣机铁
- Double.TryParse(dr1["deduction3"].ToString().Trim(), out b_txt_deduction3);//扣超长
- Double.TryParse(dr1["deduction4"].ToString().Trim(), out b_txt_deduction4);//扣轻薄
- Double.TryParse(dr1["TARE"].ToString().Trim(), out numTARE);//皮重
- Double.TryParse(dr1["GROSS"].ToString().Trim(), out numGROSS);//毛重
- string strmatchid = dr1["matchid"].ToString().Trim();//绑单号
- strMaterielRule = dr1["materielRule"].ToString().Trim();//废钢料型
- strSUTTLETIME = dr1["SUTTLETIME"].ToString().Trim();//计量时间
- row.Cells["JLQTY"].Value = numJLQTY;//净重
- row.Cells["SHIPQTY"].Value = numJLQTY;//收货量=净重
- row.Cells["KZQTY"].Value = numKZQTY;//净扣杂
- row.Cells["deduction2"].Value = b_txt_deduction2;//扣机铁
- row.Cells["deduction3"].Value = b_txt_deduction3;//扣超长
- row.Cells["deduction4"].Value = b_txt_deduction4;//扣轻薄
- row.Cells["TARE"].Value = numTARE;//皮重
- row.Cells["GROSS"].Value = numGROSS;//毛重
- row.Cells["SUTTLETIME"].Value = strSUTTLETIME;//计量时间
- row.Cells["CheckResult"].Value = strMaterielRule;//废钢料型
- row.Cells["matchid"].Value = strmatchid;//绑单号
- }
- }
- }
- GridSubDJL.UpdateData();
- }
- /// <summary>
- /// 计算非计量入库量
- /// </summary>
- /// <param name="ugr"></param>
- /// <param name="tips">1:修改采购,2修改库存</param>
- private void getInNum(UltraGridRow ugr,String strTips)
- {
- if (ugr == null)
- { return; }
- double b_SHIPQTY = 0;//收货量
- double b_ReceivedQty = 0;//入库量_实绩
- double b_InNum = 0;//入库量_编制
- double b_weightQty = 0;//库存数量
- double b_ITEMUOMCONEFFICIENT = 0;
- double.TryParse(ugr.Cells["SHIPQTY"].Value.ToString(), out b_SHIPQTY);//收获量
- double.TryParse(ugr.Cells["INNUM"].Value.ToString(), out b_InNum);//入库量_编制
- double.TryParse(ugr.Cells["RECEIVEDQTY"].Value.ToString(), out b_ReceivedQty);//入库量_实绩
- double.TryParse(ugr.Cells["weightQty"].Value.ToString(), out b_weightQty);//库存数量
- double.TryParse(ugr.Cells["ITEMUOMCONEFFICIENT"].Value.ToString(), out b_ITEMUOMCONEFFICIENT);//转换系数
- double b_NumException = 0;//待入库量
- if (ultraTabControl1.SelectedTab.Key != "3")
- {
- if (ugr.Cells["ITEMUOM"].Value.ToString() == "基吨")//库存数量可输
- {
- if (strTips == "2")
- {
- b_InNum = Math.Round(b_weightQty * b_ITEMUOMCONEFFICIENT, 3, System.MidpointRounding.AwayFromZero);
- b_NumException = b_SHIPQTY - b_weightQty;
- if (ugr.Cells["CheckStatu"].Value.ToString() == "0")//不合格
- {
- ugr.Cells["InNum"].Value = 0;
- ugr.Cells["weightQty"].Value = 0;
- //ugr.Cells["numException"].Value = Math.Round(b_SHIPQTY, 3, System.MidpointRounding.AwayFromZero);
- }
- else
- {
- ugr.Cells["InNum"].Value = b_InNum;
- //ugr.Cells["numException"].Value = b_NumException;
- }
- }
- else
- {
- b_weightQty = Math.Round(b_InNum / b_ITEMUOMCONEFFICIENT, 3, System.MidpointRounding.AwayFromZero);
- //b_NumException = b_SHIPQTY - b_weightQty;
- if (ugr.Cells["CheckStatu"].Value.ToString() == "0")//不合格
- {
- ugr.Cells["InNum"].Value = 0;
- ugr.Cells["weightQty"].Value = 0;
- // ugr.Cells["numException"].Value = Math.Round(b_SHIPQTY, 3, System.MidpointRounding.AwayFromZero);
- }
- else
- {
- ugr.Cells["weightQty"].Value = b_weightQty;
- // ugr.Cells["numException"].Value = b_NumException;
- }
- }
- }
- else
- {
- if (strTips == "2")//改库存量
- {
- //乘转换系数
- b_InNum = Math.Round(b_weightQty / b_ITEMUOMCONEFFICIENT, 3, System.MidpointRounding.AwayFromZero);
- // b_NumException = b_SHIPQTY - b_InNum;
- if (ugr.Cells["CheckStatu"].Value.ToString() == "0")//不合格
- {
- ugr.Cells["InNum"].Value = 0;
- ugr.Cells["weightQty"].Value = 0;
- // ugr.Cells["numException"].Value = b_SHIPQTY;
- }
- else
- {
- ugr.Cells["InNum"].Value = b_InNum;
- // ugr.Cells["numException"].Value = b_NumException;
- }
- }
- else//该采购量
- {
- //乘转换系数
- b_weightQty = Math.Round(b_InNum * b_ITEMUOMCONEFFICIENT, 3, System.MidpointRounding.AwayFromZero);
- // b_NumException = b_SHIPQTY - b_InNum;
- if (ugr.Cells["CheckStatu"].Value.ToString() == "0")//不合格
- {
- ugr.Cells["InNum"].Value = 0;
- ugr.Cells["weightQty"].Value = 0;
- // ugr.Cells["numException"].Value = b_SHIPQTY;
- }
- else
- {
- ugr.Cells["weightQty"].Value = b_weightQty;
- // ugr.Cells["numException"].Value = b_NumException;
- }
- }
- }
- double bUNITWEIGHT = 0;//每袋重量
- double bPACKAGEQTY = 0;//包装数量
- double.TryParse(ugr.Cells["PACKAGEQTY"].Value.ToString().Trim(), out bPACKAGEQTY);
- if (bPACKAGEQTY != 0)
- {
- bUNITWEIGHT = Math.Round(b_weightQty / bPACKAGEQTY, 3);
- }
- ugr.Cells["UNITWEIGHT"].Value = bUNITWEIGHT;
- }
- else
- {
- if (ugr.Cells["ITEMUOM"].Value.ToString() == "基吨")//库存数量可输
- {
- b_InNum = Math.Round(b_ReceivedQty * b_ITEMUOMCONEFFICIENT, 3, System.MidpointRounding.AwayFromZero);
- ugr.Cells["weightQty"].Value = b_ReceivedQty;
- ugr.Cells["RECEIVEDQTY"].Value = b_InNum;
- }
- else
- {
- b_weightQty = Math.Round(b_ReceivedQty * b_ITEMUOMCONEFFICIENT, 3, System.MidpointRounding.AwayFromZero);
- ugr.Cells["weightQty"].Value = b_weightQty;
- }
- }
- }
- /// <summary>
- /// 计算计量之后的量
- /// </summary>
- /// <returns></returns>
- private void getJlInNum(UltraGridRow ugr)
- {
- if (ugr == null)
- { return; }
- double b_JL_QTY = 0.00;
- double b_KZ_QTY = 0.00;
- double b_ITEMUOMCONEFFICIENT = 0;
- double b_txt_deduction2 = 0.00;
- double b_txt_deduction3 = 0.00;
- double b_txt_deduction4 = 0.00;
- double.TryParse(ugr.Cells["JLQTY"].Value.ToString(), out b_JL_QTY);//计量结果
- double.TryParse(ugr.Cells["KZQTY"].Value.ToString(), out b_KZ_QTY);//扣杂量
- double.TryParse(ugr.Cells["ITEMUOMCONEFFICIENT"].Value.ToString(), out b_ITEMUOMCONEFFICIENT);//转换系数
- double.TryParse(ugr.Cells["deduction2"].Value.ToString(), out b_txt_deduction2);//扣杂量
- double.TryParse(ugr.Cells["deduction3"].Value.ToString(), out b_txt_deduction3);//扣杂量
- double.TryParse(ugr.Cells["deduction4"].Value.ToString(), out b_txt_deduction4);//扣杂量
- double b_REC_QTY = 0.00;//可入库量..自动计算
- double b_weightQty = 0;//库存数量
- //b_REC_QTY = b_JL_QTY - b_KZ_QTY - b_txt_deduction2 - b_txt_deduction3 - b_txt_deduction4;//可入库量..自动计算
- b_REC_QTY = b_JL_QTY - b_txt_deduction2 - b_txt_deduction3 - b_txt_deduction4;//可入库量..自动计算
- //乘转换系数
- if (ugr.Cells["CheckStatu"].Value.ToString() == "0")
- {
- ugr.Cells["InNum"].Value = 0;
- ugr.Cells["weightQty"].Value = 0;
- // ugr.Cells["numException"].Value = Math.Round(b_REC_QTY, 3, System.MidpointRounding.AwayFromZero);
- }
- else
- {
- if (ugr.Cells["ITEMUOM"].Value.ToString() == "基吨")//库存数量可输
- {
- ugr.Cells["InNum"].Value = Math.Round(b_REC_QTY * b_ITEMUOMCONEFFICIENT, 3, System.MidpointRounding.AwayFromZero);
- ugr.Cells["weightQty"].Value = b_REC_QTY;
- }
- else
- {
- b_weightQty = Math.Round(b_REC_QTY * b_ITEMUOMCONEFFICIENT, 3);
- ugr.Cells["InNum"].Value = Math.Round(b_REC_QTY, 3, System.MidpointRounding.AwayFromZero);
- ugr.Cells["weightQty"].Value = b_weightQty;
- }
- }
- double bUNITWEIGHT = 0;//每袋重量
- double bPACKAGEQTY = 0;//包装数量
- double.TryParse(ugr.Cells["PACKAGEQTY"].Value.ToString().Trim(), out bPACKAGEQTY);
- if (bPACKAGEQTY != 0)
- {
- bUNITWEIGHT = Math.Round(b_weightQty / bPACKAGEQTY, 3);
- }
- ugr.Cells["UNITWEIGHT"].Value = bUNITWEIGHT;
- }
- /// <summary>
- /// 获取CMB
- /// </summary>
- /// <returns></returns>
- private UltraComboEditor getNewUltraComboEditor()
- {
- UltraComboEditor cmb = new UltraComboEditor();
- cmb.DropDownStyle = DropDownStyle.DropDownList;
- cmb.Visible = false;
- this.Controls.Add(cmb);
- return cmb;
- }
- /// <summary>
- /// 入库操作
- /// </summary>
- /// <param name="strTips">1:待检入库 2:正式入库</param>
- private void instock(String strTips)
- {
- try
- {
- Hashtable htAttr = new Hashtable();
- if (strTips != "1" && strTips != "2")
- {
- MessageUtil.ShowTips("入库类型参数错误 1:待检入库,2:正式入库");
- return;
- }
- int tips = Int32.Parse(strTips);
- UltraGrid ug = null;
- DataTable dt_forUsePlan = new DataTable();
- if (ultraTabControl1.SelectedTab.Key == "2")//计量
- {
- if (cbxJGZC.SelectedIndex == -1)
- {
- MessageUtil.ShowTips("请选择价格政策");
- return;
- }
- ug = GridSubDJL;
- ug.UpdateData();
- dt_forUsePlan = DTsubDJL;
- }
- else
- {
- MessageUtil.ShowTips("请选择待入库数据");
- return;
- }
- ArrayList al_CkInBillEntity = new ArrayList();//入库单表
- ArrayList al_PurCkInbillPositionEntity = new ArrayList();//入库单储位明细表
- ArrayList al_CkStorageEntity = new ArrayList();//库存
- ArrayList al_CkStoragePosEntity = new ArrayList();//库存储位
- ArrayList al_ExcDeliverySubC = new ArrayList();//送货单行
- ArrayList al_ExcDeliveryException = new ArrayList();//送货单行---正式入库记录
- Hashtable htusePlan = null;//领用单表---正式入库记录
- foreach (UltraGridRow ugr in ug.Rows)
- {
- if (ugr.Hidden || !(bool)ugr.Cells["Check"].Value)
- { continue; }
- String strSubSqe = ugr.Cells["DELIVERYSUBLINESQE"].Value.ToString().Trim();
- if (String.IsNullOrEmpty(strSubSqe))
- {
- MessageUtil.ShowTips("送货单行号为空");
- return;
- }
- ExcDeliverySubC subCOld = new ExcDeliverySubC();
- ExcDeliverySubM subMOld = new ExcDeliverySubM();
- if (String.IsNullOrEmpty(strCoustomInfo))
- {
- if (testDeliveryStatus(strSubSqe, tips, ref subCOld, ref subMOld) == false)
- {
- return;
- }
- }
- else
- {
- if (testDeliveryStatus(strSubSqe, 4, ref subCOld, ref subMOld) == false)
- {
- return;
- }
- }
- //入库数据
- double b_QTY = 0; //编制量
- double b_INNUM = 0; //入库量
- double b_ReceivedQty = 0; //收货量
- double b_ITEMUOMCONEFFICIENT = 0;//转化系数
- double b_KZQTY = 0;//扣杂
- if (ugr.Cells["ITEMUOM"].Value.ToString() == "基吨")//入库量
- {
- double.TryParse(ugr.Cells["weightqTY"].Value.ToString().Trim(), out b_INNUM);
- }
- else
- {
- double.TryParse(ugr.Cells["INNUM"].Value.ToString().Trim(), out b_INNUM);
- }
- double.TryParse(ugr.Cells["KZQTY"].Value.ToString().Trim(), out b_KZQTY);//扣杂量
- double.TryParse(ugr.Cells["SHIPQTY"].Value.ToString().Trim(), out b_ReceivedQty);//接收量
- subCOld.ShipQty = b_ReceivedQty;
- double.TryParse(ugr.Cells["ITEMUOMCONEFFICIENT"].Value.ToString().Trim(), out b_ITEMUOMCONEFFICIENT);//转换系数
- double.TryParse(ugr.Cells["QTY"].Value.ToString().Trim(), out b_QTY);//编制量
- //入库储位
- String strInvPhysic = ugr.Cells["DELETEUSERID"].Value.ToString().Trim();
- string strINVPOS = ugr.Cells["INVPOS"].Value.ToString().Trim();//入库储位
- //待处置数据
- String strRemarkException = ugr.Cells["RemarkException"].Value.ToString().Trim();//处置意见
- string strInvPosException = ugr.Cells["InvPosException"].Value.ToString().Trim();//待处置储位
- double b_non_Standard = 0;//待处置量
- double.TryParse(ugr.Cells["numException"].Value.ToString().Trim(), out b_non_Standard);
- //包装数据
- double bUNITWEIGHT = 0;//每袋重量
- double bPACKAGEQTY = 0;//包装数量
- double.TryParse(ugr.Cells["PACKAGEQTY"].Value.ToString().Trim(), out bPACKAGEQTY);
- if (bPACKAGEQTY != 0)
- {
- bUNITWEIGHT = Math.Round(b_INNUM / bPACKAGEQTY, 3);
- }
- String strPackUnit = ugr.Cells["PACKAGEUNIT"].Value.ToString().Trim();
- //计量数据
-
- double dbJLQty = ugr.Cells["JLQTY"].Value.ToString().Trim() == "" ? 0 : double.Parse(ugr.Cells["JLQTY"].Value.ToString());//净重
- double dbDeduction2 = ugr.Cells["Deduction2"].Value.ToString().Trim() == "" ? 0 : double.Parse(ugr.Cells["Deduction2"].Value.ToString());//扣机铁
- double dbDeduction3 = ugr.Cells["Deduction3"].Value.ToString().Trim() == "" ? 0 : double.Parse(ugr.Cells["Deduction3"].Value.ToString());//扣超长
- double dbDeduction4 = ugr.Cells["Deduction4"].Value.ToString().Trim() == "" ? 0 : double.Parse(ugr.Cells["Deduction4"].Value.ToString());//扣轻薄
- double dbGROSS = ugr.Cells["GROSS"].Value.ToString().Trim() == "" ? 0 : double.Parse(ugr.Cells["GROSS"].Value.ToString());//毛重
- double dbTARE = ugr.Cells["TARE"].Value.ToString().Trim() == "" ? 0 : double.Parse(ugr.Cells["TARE"].Value.ToString());//皮重
- string strmatchid = "";
- string strCheckResult = "";
- if (ultraTabControl1.SelectedTab.Key == "2")
- {
- strmatchid=ugr.Cells["matchid"].Value.ToString().Trim();//绑单号
- if (String.IsNullOrEmpty(strmatchid))
- {
- MessageUtil.ShowTips("送货单行:" + subCOld.DeliverySubLineSqe + "未绑定磅单,无法入库");
- return;
- }
- strCheckResult = ugr.Cells["CheckResult"].Value.ToString().Trim();//料型
- if (!String.IsNullOrEmpty(strCheckResult))
- {
- String keys=strCheckResult + subCOld.ItemCode;
- if (htAttr.ContainsKey(keys))
- {
- strCheckResult = (String)htAttr[keys];
- }
- else
- {
- PurClassMatAttrEntity MatAttr = new PurClassMatAttrEntity();
- MatAttr.AttrName = strCheckResult;
- //MatAttr.ItemCode = subCOld.ItemCode;
- List<PurClassMatAttrEntity> listMatAttr = this.GetJsonService().execute<List<PurClassMatAttrEntity>>("com.hnshituo.pur.configure.service.ClassMatAttrService", "find", new object[] { MatAttr,0,0});
- if (listMatAttr != null && listMatAttr.Count >= 1)//此物料判定合格
- {
- htAttr.Add(keys, listMatAttr[0].AttrCode);
- strCheckResult = listMatAttr[0].AttrCode;
- }
- else
- {
- MessageUtil.ShowTips("未发现物料:" + subCOld.ItemName + "存在料型:" + strCheckResult+",或请维护!");
- return;
- }
- }
- }
- }
- //质检数据
- String strCheckStatu = ugr.Cells["CheckStatu"].Value.ToString().Trim();
- String strCheckUser = String.IsNullOrEmpty(ugr.Cells["CHECKUSERNAME"].Value.ToString().Trim()) ? UserInfo.GetUserName() : ugr.Cells["CHECKUSERNAME"].Value.ToString().Trim();//判断人
- DateTime DtCheck = DateTime.Now;
- if (!String.IsNullOrEmpty(ugr.Cells["CHECKDATE"].Value.ToString().Trim()))
- {
- DtCheck=DateTime.Parse(ugr.Cells["CHECKDATE"].Value.ToString().Trim());
- }
-
- //校验数据--待检
- if (tips == 1)
- {
- //入库量大于0
- if (b_INNUM <= 0)
- {
- MessageUtil.ShowTips("请填写送货单行:" + strSubSqe + "的入库量");
- return;
- }
- if (strINVPOS.Trim() == "")
- {
- MessageUtil.ShowTips("请填写送货单行:" + strSubSqe + "的入库储位");
- return;
- }
- if (b_non_Standard > 0)
- {
- MessageUtil.ShowTips("送货单行:" + strSubSqe + "有待处置数量,不能做待检入库操作");
- return;
- }
- }
- //校验数据--正式
- else
- {
- if (b_INNUM > 0 && strINVPOS.Trim() == "")
- {
- MessageUtil.ShowTips("请填写送货单行:" + strSubSqe + "的入库储位");
- return;
- }
- if (strCheckStatu == "0")
- {
- if (b_non_Standard <= 0)
- {
- MessageUtil.ShowTips("送货单行:" + strSubSqe + "的综合判定结果为不合格,待处置量必须>0");
- return;
- }
- }
- else
- {
- if (b_INNUM <= 0)
- {
- MessageUtil.ShowTips("送货单行:" + strSubSqe + "的综合判定结果为合格,入库量必须>0");
- return;
- }
- }
- //交货量差控制
- if (testDeliveryQtyCtrl(subMOld, subCOld,b_INNUM) == false)
- {
- return;
- }
- }
-
- //包装单位校验
- if (!String.IsNullOrEmpty(strPackUnit))
- {
- if (strPackUnit.Length >= 35)
- {
- MessageUtil.ShowTips("送货单行:" + strSubSqe + "的包装单位字符串多长,请控制在10个字以内");
- return;
- }
- if (bPACKAGEQTY <= 0 || bUNITWEIGHT<=0)
- {
- MessageUtil.ShowTips("送货单行:" + strSubSqe + "的包装单位信息不全,包装数量和包装重量不能为空");
- return;
- }
- }
- if (bPACKAGEQTY>0)
- {
- if (String.IsNullOrEmpty(strPackUnit))
- {
- MessageUtil.ShowTips("送货单行:" + strSubSqe + "的包装单位信息不全,请填写包装单位");
- return;
- }
- }
- PurCkInBillEntity CkInBillEntity = new PurCkInBillEntity();//入库单表
- CkStorage CkStorageEntity = new CkStorage();
- PurCkStoragePosEntity CkStoragePosEntity = new PurCkStoragePosEntity();//库存收发存表
- PurCkInbillPositionEntity CkInbillPositionEntity = new PurCkInbillPositionEntity();//入库单储位明细表
- ExcDeliveryException edecp = new ExcDeliveryException();//异常处理信息
- ExcDeliverySubC EdC = new ExcDeliverySubC();
- EdC.Status = "5";//正式入库
- if (tips == 1)
- {
- EdC.Status = "4";//待检入库
- }
- //正式入库---待处置入库
- if (b_non_Standard > 0 && tips == 2)
- {
- //异常单
- edecp.DeliverySubLineSqe = strSubSqe;
- edecp.DeliverySubId = subMOld.DeliverySubId;
- edecp.Qty = b_non_Standard;
- if (String.IsNullOrEmpty(strRemarkException))
- {
- MessageUtil.ShowTips("送货单行:" + strSubSqe + "有待处置量,待处置原因或意见不能为空");
- return;
- }
- if (String.IsNullOrEmpty(strInvPosException))
- {
- MessageUtil.ShowTips("送货单行:" + strSubSqe + "有待处置量,待检储位不能为空");
- return;
- }
- edecp.Remark = strRemarkException;
- edecp.InvPos = strInvPosException;
- edecp.InvPhysic = strInvPhysic;
- edecp.Ecptype = "3";
- edecp.Validflag = "1";
- edecp.Status = "1";
- edecp.CreateName = UserInfo.GetUserName();
- edecp.CreateUserid = UserInfo.GetUserID();
- edecp.CreateTime = System.DateTime.Now;
- al_ExcDeliveryException.Add(edecp);
- }
- if (strCheckStatu != "0")//合格入库
- {
-
- CkInBillEntity.RefeId = strSubSqe;//送货通知单行号
- CkInBillEntity.RefType = "2";
- CkInBillEntity.InvPhysic = strInvPhysic;
- CkInBillEntity.ItemUomConefficient = b_ITEMUOMCONEFFICIENT;
- CkInBillEntity.Status = tips == 2 ? "1" : "0";// 状态
- CkInBillEntity.InNum = b_INNUM;//入库量
- //读取计量结果
- CkInBillEntity.JlQty = dbJLQty; //净重
- CkInBillEntity.KzQty = b_KZQTY;//扣杂
- CkInBillEntity.Deduction2 = dbDeduction2;//扣机铁
- CkInBillEntity.Deduction3 = dbDeduction3;//扣超长
- CkInBillEntity.Deduction4 = dbDeduction4;//扣轻薄
- CkInBillEntity.Gross = dbGROSS;//毛重
- CkInBillEntity.Tare = dbTARE;//皮重
- CkInBillEntity.Matchid = strmatchid;
- if (ugr.Cells["Suttletime"].Value.ToString().Trim() != "")
- {
- CkInBillEntity.Suttletime= DateTime.Parse(ugr.Cells["Suttletime"].Value.ToString().Trim());
- }
- CkInBillEntity.Result = strCheckResult;
- //包装
- if (!String.IsNullOrEmpty(strPackUnit))
- {
- CkInBillEntity.PackageQty = bPACKAGEQTY + "";//包装数
- CkInBillEntity.UnitWeight = bUNITWEIGHT;//每包重量
- CkInBillEntity.PackageUnit = strPackUnit + "";//包装单位
- }
- CkInBillEntity.CreateUserid = UserInfo.GetUserID();
- CkInBillEntity.CreateName = UserInfo.GetUserName();
- CkInBillEntity.CreateTime = DateTime.Now;
- CkInBillEntity.InstockDate = DateTime.Now;
- CkInBillEntity.OperateOrgId = UserInfo.GetDeptid();
- CkInBillEntity.OperateOrgName = UserInfo.GetDepartment();
- CkInBillEntity.UpdateName = null;
- CkInBillEntity.UpdateUserid = null;
- CkInBillEntity.UpdateTime = null;
- //检化验数据
- CkInBillEntity.Result = strCheckResult;//检验结果(料型或者等级)
- CkInBillEntity.CheckResult = strCheckStatu;//判定是否合格
- CkInBillEntity.CheckDate = DtCheck;//判定时间
- CkInBillEntity.CheckUserName = strCheckUser;//判断人
- CkInBillEntity.BasePriceId = cbxJGZC.Value.ToString();//获取价格政策id
- CkInBillEntity.BasePriceName = cbxJGZC.SelectedItem.ToString();//获取价格政策名称
- // CkInBillEntity.TxtLEN_DEDUCT_PRICE = dbDeduction3 > 0 ? double.Parse(txtLEN_DEDUCT_PRICE.Value.ToString()) : 0;//超长扣减
- CkInBillEntity.TxtLEN_DEDUCT_PRICE = double.Parse(txtLEN_DEDUCT_PRICE.Value.ToString());
- CkInBillEntity.Txt_check = double.Parse(txt_check.Value.ToString());//考核
- CkInBillEntity.Txt_honour = double.Parse(txt_honour.Value.ToString());//承兑加价
- CkInBillEntity.Txt_volume = double.Parse(txt_volume.Value.ToString());//保量加价
- al_CkInBillEntity.Add(CkInBillEntity);
- //-----------------------------------------------------------------------------库存单表
- CkStorageEntity.RefeId = CkInBillEntity.RefeId;
- CkStorageEntity.Status = tips == 2 ? "1" : "0";
- CkStorageEntity.UseStatus = tips == 2 ? "1" : "0";
- CkStorageEntity.Validflag = "1";
- CkStorageEntity.InvPhysic = strInvPhysic;
- CkStorageEntity.InvQty = b_INNUM;//库存数量
- CkStorageEntity.InvOrigQty = b_INNUM;//期初库存数量
- if (!String.IsNullOrEmpty(strPackUnit))
- {
- CkStorageEntity.PackageQty = bPACKAGEQTY + "";//包装数
- CkStorageEntity.UnitWeight = bUNITWEIGHT + "";//每包重量
- CkStorageEntity.PackageUnit = strPackUnit + "";//包装单位
- }
- CkStorageEntity.CreateUserid = UserInfo.GetUserID();
- CkStorageEntity.CreateName = UserInfo.GetUserName();
- CkStorageEntity.OperateOrgId = UserInfo.GetDeptid();
- CkStorageEntity.OperateOrgName = UserInfo.GetDepartment();
- CkStorageEntity.UpdateName = null;
- CkStorageEntity.UpdateUserid = null;
- CkStorageEntity.UpdateTime = null;
- CkStorageEntity.ItemUomConefficient = b_ITEMUOMCONEFFICIENT;
- //检化验数据
- CkStorageEntity.Result = "";//检验结果(料型或者等级)
- CkStorageEntity.CheckResult = strCheckStatu;//判定是否合格
- CkStorageEntity.CheckDate = DtCheck;//判定时间
- CkStorageEntity.CheckUsername = strCheckUser;//判断人
- al_CkStorageEntity.Add(CkStorageEntity);
- //-----------------------------------------------------------------------------------------------------------入库单储位明细表
- CkInbillPositionEntity.InStockNo = CkInBillEntity.RefeId;// ultraGrid5.ActiveRow.Cells["DELIVERYSUBLINESQE"].Value.ToString();//入库单号记录送货通知单行号,方便在后台获取入库单号
- CkInbillPositionEntity.Validflag = "1";
- CkInbillPositionEntity.InNum = b_INNUM;//入库量
- CkInbillPositionEntity.InvPhysic = CkInBillEntity.InvPhysic;//物理库区
- CkInbillPositionEntity.InvPos = strINVPOS; ;//库位
- CkInbillPositionEntity.CreateUserid = UserInfo.GetUserID();
- if (!String.IsNullOrEmpty(strPackUnit))
- {
- CkInbillPositionEntity.PackageQty = bPACKAGEQTY + "";//包装数量
- }
- CkInbillPositionEntity.CreateUserid = UserInfo.GetUserID();
- CkInbillPositionEntity.CreateName = UserInfo.GetUserName();
- al_PurCkInbillPositionEntity.Add(CkInbillPositionEntity);//添加入库单储位明细表
- //---------------------------------------------------------------------------------------------------------------------------------库存储位明细表
- CkStoragePosEntity.InvId = CkInBillEntity.RefeId;//库存记录号记录发货通知单行号,方便在后台获取入库单号
- CkStoragePosEntity.Validflag = "1";
- CkStoragePosEntity.InvOrigQty = b_INNUM;//期初入库量
- CkStoragePosEntity.InvQty = b_INNUM;//库存数量
- CkStoragePosEntity.InvPhysic = CkInBillEntity.InvPhysic; //txt_INV_PHYSIC.Value == null ? null : txt_INV_PHYSIC.Value.ToString();//物理库区
- CkStoragePosEntity.InvPos = strINVPOS;//ugr_5.Cells["INVPOS"].Value.ToString();//库位
- if (!String.IsNullOrEmpty(strPackUnit))
- {
- CkStoragePosEntity.PackageQty = bPACKAGEQTY + "";//包装数量
- CkStoragePosEntity.PackageUnit = strPackUnit + "";//包装单位
- CkStoragePosEntity.UnitWeight = bUNITWEIGHT;//每袋重量
- }
- CkStoragePosEntity.InvQtyWeight = b_INNUM * b_ITEMUOMCONEFFICIENT;
- CkStoragePosEntity.CreateUserid = UserInfo.GetUserID();
- CkStoragePosEntity.CreateName = UserInfo.GetUserName();
- al_CkStoragePosEntity.Add(CkStoragePosEntity);//添加库存单储位明细表
- }
- //送货单
- EdC.DeliverySubLineSqe = strSubSqe;//送货通知单行号
- //获取计量信息
- EdC.JlQty = dbJLQty;//计量结果
- EdC.ReceivedQty = b_INNUM;//实际入库量
- EdC.KzQty = b_KZQTY;//扣杂量
- EdC.ItemUomConefficient = b_ITEMUOMCONEFFICIENT;
- EdC.Deduction2 = dbDeduction2;//扣机铁
- EdC.Deduction3 = dbDeduction3;//扣超长
- EdC.Deduction4 = dbDeduction4;//扣轻薄
- EdC.Matchid = strmatchid;
- EdC.PackageQty = bPACKAGEQTY + "";//包装数量
- EdC.PackageUnit = strPackUnit + "";//包装单位
- EdC.UnitWeight = bUNITWEIGHT;//每袋重量
- EdC.RkName = UserInfo.GetUserName();
- EdC.RkUserid = UserInfo.GetUserID();
- EdC.RkTime = DateTime.Now;
- al_ExcDeliverySubC.Add(EdC);
- }
- if (al_ExcDeliverySubC.Count < 1)
- {
- MessageUtil.ShowTips("请勾选送货单");
- return;
- }
- CoreResult crt = new CoreResult();
- if (tips == 1)
- {
- if (MessageUtil.ShowYesNoAndQuestion("确定待检入库?") != DialogResult.Yes)
- {
- return;
- }
- crt = this.GetJsonService().execute<CoreResult>("com.hnshituo.pur.ck.service.ExcDeliverySubMService", "doWaitInstock", new object[] { al_ExcDeliverySubC, al_CkInBillEntity, al_PurCkInbillPositionEntity, al_CkStorageEntity, al_CkStoragePosEntity,strCoustomInfo });
- }
- else if (tips == 2)
- {
- frmPopSetCkInBillOutNum frm = new frmPopSetCkInBillOutNum(this.ob, dt_forUsePlan, al_ExcDeliverySubC);
- frm.ShowDialog();
- htusePlan = frm.ht;
- if (frm.strTips == "0")
- {
- return;
- }
- else
- {
- if (frm.strTips == "1")
- {
- if (MessageUtil.ShowYesNoAndQuestion("确定正式入库? 若存在异常单数量,请及时输入异常单数量并及时通知业务员进行异常单处置。") != DialogResult.Yes)
- {
- return;
- }
- }
- }
- crt = this.GetJsonService().execute<CoreResult>("com.hnshituo.pur.ck.service.CkInBillService", "doInstock", new object[] { al_CkInBillEntity, al_PurCkInbillPositionEntity, al_CkStorageEntity, al_CkStoragePosEntity, al_ExcDeliverySubC, al_ExcDeliveryException, htusePlan, strCoustomInfo});
- }
- else
- {
- MessageUtil.ShowTips("入库类型参数错误 1:待检入库,2:正式入库");
- return;
- }
- if (crt.Resultcode != 0)
- {
- MessageUtil.ShowTips("操作失败 " + crt.Resultmsg);
- return;
- }
- MessageUtil.ShowTips("操作成功");
- Get_PUR_EXC_DELIVERY_M("");
- }
- catch (System.Exception ex)
- {
- MessageUtil.ShowTips("操作失败:" + ex.Message);
- }
- }
- #endregion
- #region 交货量差控制
- private bool testDeliveryQtyCtrl(ExcDeliverySubM subMOld, ExcDeliverySubC subCOld, double b_INNUM)
- {
- String strSupp = subMOld.SuppCode;
- String strItemCode = subCOld.ItemCode;
- Entity_SuppGrade grade = new Entity_SuppGrade();
- grade.SuppCode = strSupp;
- grade.ItemCode = strItemCode;
- double qty = (double)subCOld.ShipQty;
- List<Entity_SuppGrade> listGrade = this.execute<List<Entity_SuppGrade>>("com.hnshituo.pur.configure.service.SuppGradeService", "find", new object[] { grade,0,0 });//添加操作
- if (listGrade != null && listGrade.Count >= 1)
- {
- grade = listGrade[0];
- if (grade.DelvryRangeTpe == "0")
- {
- return true;
- }
- else if (grade.DelvryRangeTpe == "1")//绝对值
- {
- double maxQty = (double)grade.DelvryRangeMax + qty;
- double minQty = qty - (double)grade.DelvryRangeMin;
- if (b_INNUM > maxQty)
- {
- MessageUtil.ShowTips("供应商:" + subMOld.SuppName + "的物料:" + subCOld.ItemName + "的入库量已经超出交货量上限为:" + maxQty);
- return false;
- }
- if (b_INNUM < minQty)
- {
- MessageUtil.ShowTips("供应商:" + subMOld.SuppName + "的物料:" + subCOld.ItemName + "的入库量已经超出交货量下限为:" + minQty);
- return false;
- }
- }
- else if (grade.DelvryRangeTpe == "2")//百分比
- {
- double maxQty = Math.Round(qty * (1 + (double)grade.DelvryRangeMax / 100), 3);
- double minQty = Math.Round(qty * (1 - (double)grade.DelvryRangeMax / 100), 3);
- if (b_INNUM > maxQty)
- {
- MessageUtil.ShowTips("供应商:" + subMOld.SuppName + "的物料:" + subCOld.ItemName + "的入库量已经超出交货量上限为:" + maxQty);
- return false;
- }
- if (b_INNUM < minQty)
- {
- MessageUtil.ShowTips("供应商:" + subMOld.SuppName + "的物料:" + subCOld.ItemName + "的入库量已经超出交货量下限为:" + minQty);
- return false;
- }
- }
- else if (grade.DelvryRangeTpe == "2") //不允许
- {
- if (b_INNUM != qty)
- {
- MessageUtil.ShowTips("供应商:" + subMOld.SuppName + "的物料:" + subCOld.ItemName + "的入库量不允许有交货量差,入库量和和要求送货量必须一致");
- return false;
- }
- }
- else
- {
- MessageUtil.ShowTips("请维护供应商:" + subMOld.SuppName + "的物料:" + subCOld.ItemName + "的交货量差方式");
- return false;
- }
- }
- else
- {
- MessageUtil.ShowTips("请维护供应商:" + subMOld.SuppName + "的物料:" + subCOld.ItemName + "的交货量差");
- return false;
- }
- return true;
- }
- #endregion
- #region 公共函数
- /// <summary>
- /// 设置可编辑的单元格及其颜色
- /// </summary>
- /// <param name="ugr"></param>
- /// <param name="columnName"></param>
- private void setCellColor(UltraGridRow ugr, Color color, params string[] columnName)
- {
- for (int i = 0; i < columnName.Length; i++)
- {
- columnName[i] = columnName[i].ToUpper();
- }
- foreach (UltraGridCell ugc in ugr.Cells)
- {
- if (columnName.Contains(ugc.Column.Key.ToString().ToUpper()))
- {
- ugc.Appearance.BackColor = color;
- ugc.Activation = Activation.AllowEdit;
- }
- else
- {
- ugc.Appearance.BackColor = ugr.Cells["status"].Appearance.BackColor;
- ugc.Activation = Activation.ActivateOnly;
- }
- if (ugc.Column.Key.ToString().ToUpper() == "CHECK")
- {
- ugc.Appearance.BackColor = color;
- ugc.Activation = Activation.AllowEdit;
- }
- }
- }
- /// <summary>
- /// 设置单元格颜色,和在可编辑状态
- /// </summary>
- /// <param name="ugr"></param>
- /// <param name="columnName"></param>
- private void setColumnColor(UltraGrid ug, Color color, params string[] columnName)
- {
- return;
- for (int i = 0; i < columnName.Length; i++)
- {
- columnName[i] = columnName[i].ToUpper();
- }
- foreach (UltraGridColumn ugc in ug.DisplayLayout.Bands[0].Columns)
- {
- if (columnName.Contains(ugc.Key.ToString().ToUpper()))
- {
- ugc.CellAppearance.BackColor = color;
- ugc.CellActivation = Activation.AllowEdit;
- }
- else
- {
- ugc.CellAppearance.BackColor = ug.DisplayLayout.Bands[0].Columns["status"].CellAppearance.BackColor;
- ugc.CellActivation = Activation.ActivateOnly;
- }
- }
- }
- #endregion
- #region 计量-检化验-异常单 行信息
- /// <summary>
- /// 查询非计量入库单质检、异常单信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void GridSubDNoJL_ClickCell(object sender, ClickCellEventArgs e)
- {
- UltraGridRow row = e.Cell.Row;
- String subSqe = row.GetCellValue("DELIVERYSUBLINESQE").ToString().Trim();
- ArrayList list = new ArrayList();
- list.Add(subSqe);
- String sordSqe = row.GetCellValue("ORDERLINESQE").ToString().Trim();
- ArrayList list1 = new ArrayList();
- list1.Add(sordSqe);
- getDetailForSubD((string[])list.ToArray(typeof(string)), "1", (string[])list1.ToArray(typeof(string)));
- }
- /// <summary>
- /// 查询计量入库单质检、异常单信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void GridSubDJL_ClickCell(object sender, ClickCellEventArgs e)
- {
-
- }
- /// <summary>
- /// 查询实绩入库单质检、异常单信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void GridSubDSJ_ClickCell(object sender, ClickCellEventArgs e)
- {
- UltraGridRow row = e.Cell.Row;
- String subSqe = row.GetCellValue("DELIVERYSUBLINESQE").ToString().Trim();
- ArrayList list = new ArrayList();
- list.Add(subSqe);
- String sordSqe = row.GetCellValue("ORDERLINESQE").ToString().Trim();
- ArrayList list1 = new ArrayList();
- list1.Add(sordSqe);
- getDetailForSubD((string[])list.ToArray(typeof(string)), "3", (string[])list1.ToArray(typeof(string)));
- }
- /// <summary>
- /// 获取计量-检化验-异常单数据
- /// </summary>
- /// <param name="subSqe"></param>
- /// <param name="p"></param>
- private void getDetailForSubD(String[] list, string p, String[] orderList)
- {
- if ("2" == p)
- {
- publicPms.clearOldData(panel_JL, new string[] { });
- }
- else if ("3" == p)
- {
- publicPms.clearOldData(panel_sj, new string[] { });
- }
- JHY.Clear();
- JLdata.Clear();
- exception.Clear();
- //DataTable data1 = new DataTable();
- if (list.Length>0)
- {
- DataTable dtjl = null;
- for (int i = 0; i < list.Length; i++) //根据选中的行数循环获取榜单记录
- {
- String subSqe = list[i].ToString();
- ExcDeliverySubC subc = this.GetJsonService().execute<ExcDeliverySubC>("com.hnshituo.pur.ck.service.ExcDeliverySubCService", "findById", new object[] { subSqe });
- if (subc == null)
- {
- return;
- }
- String strCheckNo = subc.CheckNo;
- //查询检化验
- if (!String.IsNullOrEmpty(strCheckNo))
- {
- CheckconsignBaseinfo baseinfo = new CheckconsignBaseinfo();
- baseinfo.CheckNo = strCheckNo;
- List<CheckconsignBaseinfo> Listbaseinfo = this.GetJsonService().execute<List<CheckconsignBaseinfo>>("com.hnshituo.pur.jhy.service.CheckconsignBaseinfo_jhyService", "doQuery_Baseinfo", new object[] { baseinfo });
- if (Listbaseinfo != null && Listbaseinfo.Count >= 1)
- {
- baseinfo = Listbaseinfo[0];
- if ("2" == p)
- {
- JHY_check_no_JL.Text = baseinfo.CheckNo;
- JHY_CHECK_COUNT_JL.Text = baseinfo.CheckCount;
- JHY_CONSIGN_DEPT_JL.Text = baseinfo.ConsignDept;
- JHY_CONSIGN_NAME_JL.Text = baseinfo.ConsignName;
- JHY_CONSIGN_TIME_JL.Value = baseinfo.ConsignTime;
- JHY_IS_JUDGE_JL.Text = baseinfo.IsJudge;
- JHY_JUDGE_LEVEL_JL.Text = baseinfo.JudgeLevel;
- JHY_PRODUCT_STD_JL.Text = baseinfo.ProductStd;
- }
- else if ("3" == p)
- {
- JHY_check_no_SJ.Text = baseinfo.CheckNo;
- JHY_CHECK_COUNT_SJ.Text = baseinfo.CheckCount;
- JHY_CONSIGN_DEPT_SJ.Text = baseinfo.ConsignDept;
- JHY_CONSIGN_NAME_SJ.Text = baseinfo.ConsignName;
- JHY_CONSIGN_TIME_SJ.Value = baseinfo.ConsignTime;
- JHY_IS_JUDGE_SJ.Text = baseinfo.IsJudge;
- JHY_JUDGE_LEVEL_SJ.Text = baseinfo.JudgeLevel;
- JHY_PRODUCT_STD_SJ.Text = baseinfo.ProductStd;
- }
- //加载行表
- CheckconsignDetail detail = new CheckconsignDetail();
- detail.CheckNo = strCheckNo;
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.jhy.service.CheckconsignDetail_jhyService", "doQuery_Detail", new object[] { detail, 0, 0 });
- GridHelper.CopyDataToDatatable(dt, DTJHY, true);
- }
- }
- //加载异常单
- ExcDeliveryException hand = new ExcDeliveryException();
- hand.DeliverySubLineSqe = list[i].ToString();
- hand.Validflag = "1";
- DataTable dte = this.execute<DataTable>("com.hnshituo.pur.ck.service.ExcDeliveryExceptionService", "doQuery_Exceptions", new object[] { hand });
- GridHelper.CopyDataToDatatable(dte, DTHandle, true);
- //if ("2" == p)
- //{
- // //加载计量数据
- // QSubSqe_JL.Text = list[i].ToString();
- // // dtjl = getJLData("");
- // // data1.Merge(dtjl); //合并datatable 循环查询选中的送货单行号
- // // GridHelper.CopyDataToDatatable(data1, DTJL, true);//下表查询到的榜单 赋值给DTJL
- dtjl = getJLData(orderList);
- // GridHelper.CopyDataToDatatable(dtjl, DTJL, true);//下表查询到的榜单 赋值给DTJL
- // GridHelper.RefreshAndAutoSize(GridJHY_JL);
- // GridHelper.RefreshAndAutoSize(GridHandleJL);
- // GridHelper.RefreshAndAutoSize(GridJL_JL);
- //}
- //else if ("3" == p)
- if("3"==p)
- {
- if (!String.IsNullOrEmpty(subc.Matchid))
- {
- //加载计量数据
- //dtjl = getJLData(subc.Matchid);
- if (dtjl != null && dtjl.Rows.Count > 0)
- {
- GridHelper.CopyDataToDatatable(dtjl, DTJL, true);//下标查询到的榜单 赋值给DTJL
- // GridHelper.CopyDataToDatatable(dtjl, DTJL, true);
- }
- }
- //加载入库数据
- PurCkInBillEntity pcibEntity = new PurCkInBillEntity();
- pcibEntity.RefeId = subSqe;
- DataTable dtinbill = this.execute<DataTable>("com.hnshituo.pur.ck.service.CkInBillService", "GetCkInBill", new object[] { pcibEntity });
- GridHelper.CopyDataToDatatable(dtinbill, DTinbill, true);
- GridHelper.RefreshAndAutoSize(GridJHY_SJ);
- GridHelper.RefreshAndAutoSize(GridHandleSJ);
- GridHelper.RefreshAndAutoSize(GridJL_SJ);
- GridHelper.RefreshAndAutoSize(GridInbill);
- }
- }
- if ("2" == p)
- {
- //加载计量数据
- //QSubSqe_JL.Text = list[i].ToString();
- // dtjl = getJLData("");
- // data1.Merge(dtjl); //合并datatable 循环查询选中的送货单行号
- // GridHelper.CopyDataToDatatable(data1, DTJL, true);//下表查询到的榜单 赋值给DTJL
- //dtjl = getJLData(list);
- GridHelper.CopyDataToDatatable(dtjl, DTJL, true);//下表查询到的榜单 赋值给DTJL
- GridHelper.RefreshAndAutoSize(GridJHY_JL);
- GridHelper.RefreshAndAutoSize(GridHandleJL);
- GridHelper.RefreshAndAutoSize(GridJL_JL);
- }
-
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private DataTable getJLData(String[] ordernos)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;//等待
- Hashtable ht = new Hashtable();
- // if(String.IsNullOrEmpty(strMatchId))
- if (ordernos.Length>0)
- {
- ht.Add("materialcode", QitemCode_JL.Text.Trim());
- ht.Add("materialname", QitemName_JL.Text.Trim());
- ht.Add("sourcecode", QsuppCode_JL.Text.Trim());
- ht.Add("sourcename", QSuppName_JL.Text);
- if (ck_shutt_JL.Checked)
- {
- if (txt_shuttTimeStart_JL.Value != null)
- {
- ht.Add("suttletime", ((DateTime)txt_shuttTimeStart_JL.Value).ToString("yyyy-MM-dd") + " 00:00:00");//净重时间开始
- }
- if (txt_shuttTimeEnd_JL.Value != null)
- {
- ht.Add("taretime", ((DateTime)txt_shuttTimeEnd_JL.Value).ToString("yyyy-MM-dd") + " 23:59:59");//净重时间结束
- }
- }
- ht.Add("matchid", Qmatchid_JL.Text.Trim());
- ht.Add("carno", QCarNo_JL.Text.Trim());
- // ht.Add("orderno", QSubSqe_JL.Text.Trim());
- ht.Add("ordernos", ordernos);
- ht.Add("updateUserid", "5");
- DataTable subc = this.execute<DataTable>("com.hnshituo.pur.ck.service.ExcDeliverySubCService", "Query_C", new object[] { ht });
- ArrayList matchids = new ArrayList();
- for (int i = 0; i < subc.Rows.Count; i++)
- {
- matchids.Add(subc.Rows[i]["MATCHID"].ToString2());
- }
- if (matchids.Count > 0)
- {
- ht.Add("matchidsnNotIn", (string[])matchids.ToArray(typeof(string)));
- }
-
- }
- else
- {
- ht.Add("materialcode", QitemCode_JL.Text.Trim());
- ht.Add("materialname", QitemName_JL.Text.Trim());
- ht.Add("sourcecode", QsuppCode_JL.Text.Trim());
- ht.Add("sourcename", QSuppName_JL.Text);
- if (ck_shutt_JL.Checked)
- {
- if (txt_shuttTimeStart_JL.Value != null)
- {
- ht.Add("suttletime", ((DateTime)txt_shuttTimeStart_JL.Value));//净重时间开始
- }
- if (txt_shuttTimeEnd_JL.Value != null)
- {
- ht.Add("taretime", ((DateTime)txt_shuttTimeEnd_JL.Value));//净重时间结束
- }
- }
- ht.Add("matchid", Qmatchid_JL.Text.Trim());
- ht.Add("carno", QCarNo_JL.Text.Trim());
- // ht.Add("orderno", QSubSqe_JL.Text.Trim());
- ht.Add("ordernos", ordernos);
- }
-
- DataTable dt = this.GetJsonService().execute<DataTable>("com.hnshituo.pur.utils.service.UtilsService", "readData", new object[] { ht });
- return dt;
- }
- catch (System.Exception e)
- {
- MessageUtil.ShowTips("加载计量数据异常:" + e.Message);
- return null;
- }
- finally
- {
- this.Cursor = Cursors.Default;//鼠标状态恢复正常
- }
- }
- #endregion
- //选中送货行单(右上表) 触发事件
- private void GridSubDJL_AfterRowActivate(object sender, System.EventArgs e)
- {
- //获取选中的行数的 送货单行
- IQueryable<UltraGridRow> uGridss = GridSubDJL.Rows.AsQueryable().Where(" Check = 'True'");
- ArrayList list = new ArrayList();
- ArrayList list1 = new ArrayList();
- foreach (UltraGridRow ugrs in uGridss)
- {
- String shdhid = ugrs.Cells["DELIVERYSUBLINESQE"].Value.ToString();
- list.Add(shdhid);
- String sordSqe = ugrs.GetCellValue("ORDERLINESQE").ToString().Trim();
- list1.Add(sordSqe);
- }
- if (GridSubDJL.ActiveRow == null)
- return;
- //DTJL.Clear();
- getDetailForSubD((string[])list.ToArray(typeof(string)), "2", (string[])list1.ToArray(typeof(string)));
- }
- //计算加减价后价格政策明细单价
- private void setJGZCPrice(DataTable re)
- {
- if (!StringUtil.Is_Below_zero(txt_honour.Text.Trim()))
- {
- txt_honour.Text = "0";
- }
- if (!StringUtil.Is_Below_zero(txt_volume.Text.Trim()))
- {
- txt_volume.Text = "0";
- }
- if (!StringUtil.Is_Below_zero(txt_check.Text.Trim()))
- {
- txt_check.Text = "0";
- }
- if (!StringUtil.Is_Below_zero(txtLEN_DEDUCT_PRICE.Text.Trim()))
- {
- txtLEN_DEDUCT_PRICE.Text = "0";
- }
- //double addNum = Convert.ToDouble(txtADD_PRICE.Text.Trim());
- //double addNum = Convert.ToDouble(txt_honour.Text.Trim()) + Convert.ToDouble(txt_volume.Text.Trim()) - Convert.ToDouble(txt_check.Text.Trim()) - Convert.ToDouble(txtLEN_DEDUCT_PRICE.Text.Trim());
- double addNum = Convert.ToDouble(txt_honour.Text.Trim()) + Convert.ToDouble(txt_volume.Text.Trim()) - Convert.ToDouble(txt_check.Text.Trim());
- foreach (DataRow dr in re.Rows)
- {
- dr["priceVal"] = Convert.ToDouble(dr["priceVal"].ToString()) + addNum;
- }
- }
- private void bindPrice() {
- if (cbxJGZC.SelectedIndex == -1)
- {
- MessageUtil.ShowTips("请选择价格政策计算废钢价格!");
- return;
- }
- BalanceBasepriceC pc = new BalanceBasepriceC();
- pc.StandId = cbxJGZC.Value.ToString();
- pc.Validflag = "1";
- //调用服务器查询API进行查询
- DataTable re = this.execute<DataTable>("com.hnshituo.pur.balance.service.BalanceBasepriceCService", "doQureyBasePriceC", new object[] { pc });
- setJGZCPrice(re);
- Double priceVal = 0;
- Double jlqty = 0;
- Double sl = 1.13;//税率
- foreach (UltraGridRow row in GridSubDJL.Rows)
- {
- String checkResult = row.GetCellValue("CheckResult").ToString().Trim();
- if (row.Cells["JLQTY"].Value.ToString().Trim() != "0.00" && !String.IsNullOrEmpty(checkResult))
- {
- foreach (DataRow dr in re.Rows)
- {
- if (checkResult == dr["gradeLevel"].ToString())
- {
- Double.TryParse(dr["priceVal"].ToString().Trim(), out priceVal);//计价值
- Double.TryParse(row.Cells["JLQTY"].Value.ToString().Trim(), out jlqty);//净重
- row.Cells["regularPrice"].Value = Math.Round(priceVal, 4).ToString();//含税单价
- row.Cells["regularPriceVal"].Value = Math.Round(priceVal * jlqty, 4).ToString();//含税价格
- row.Cells["price"].Value = Math.Round(priceVal / sl, 4).ToString();//不含税单价
- row.Cells["priceVal"].Value = Math.Round(priceVal / sl * jlqty, 4).ToString();//含税价格
- }
- }
- }
- }
- }
- }
- }
|