def get_product_list(self): self.treeWidget_prodlist.clear() self.treeWidget_prodlist.hideColumn(0) key_dict = {'snid': self.autoid} prod_list = self.SC.get_salenotegoods(False, *VALUES_TUPLE_PROD, **key_dict) if not len(prod_list): return for item in prod_list: qtreeitem = QTreeWidgetItem(self.treeWidget_prodlist) qtreeitem.setText(0, str(item['autoid'])) qtreeitem.setText(1, item['prodid'] + ' ' + item['prodname']) qtreeitem.setText(2, item['spec']) qtreeitem.setText(3, item['package']) qtreeitem.setText(4, to_str(item['saleamount'])) qtreeitem.setText(5, item['spunit']) prodid = item['prodid'] key_dict_rep = {'prodid': prodid, 'stockamount__gt': 0} product_rep_list = self.WC.get_productrepository( False, *VALUES_TUPLE_REP, **key_dict_rep).annotate(amount=Sum('stockamount')) if len(product_rep_list): qtreeitem.setText(6, to_str(product_rep_list[0]['amount'])) else: qtreeitem.setText(6, '0') for i in range(1, 7): self.treeWidget_prodlist.resizeColumnToContents(i)
def get_stufflist(self): self.treeWidget_stufflist.clear() self.treeWidget_stufflist.hideColumn(0) key_dict = {'sdpid': self.autoid} if self.label_status.text() == "已完成": key_dict['backamount__gt'] = 0 res = self.SC.get_prodstuff(False, *VALUES_TUPLE_STUFF, **key_dict) if len(res): for item in res: qtreeitem = QTreeWidgetItem(self.treeWidget_stufflist) qtreeitem.setText(0, str(item['autoid'])) # autoid qtreeitem.setText(1, item['stuffid'] + ' ' + item['stuffname']) # 物料 qtreeitem.setText(2, item['batchno']) # 进厂批号 qtreeitem.setText(3, item['spec']) # 含量规格 qtreeitem.setText(4, item['package']) # 包装规格 qtreeitem.setText(5, to_str(item['presamount']) + item['presunit']) # 计划量 qtreeitem.setText(6, to_str(item['pracamount']) + item['pracunit']) # 实际量 qtreeitem.setText(7, to_str(item['drawamount']) + item['drawunit']) # 领取量 qtreeitem.setText(8, to_str(item['restamount']) + item['drawunit']) # 剩余量 qtreeitem.setText(9, to_str(item['backamount']) + item['drawunit']) # 退库量量 qtreeitem.setText(10, item['wdid'] + item['wdname']) for i in range(1, 11): self.treeWidget_stufflist.resizeColumnToContents(i)
def set_batchno_tree(self, current_tree, product_list): p_list = product_list.values(*VALUES_TUPLE_BATCHNO) """ .extra( select={ 'prodid': 'prodid', 'prodname': 'prodname', 'spec': 'spec', 'commonname': 'commonname', 'batchno': 'batchno', 'package': 'package', 'spunit': 'spunit', 'makedate': 'makedate', 'expireddates': 'expireddates' }, tables=['producingplan'], where=['producingplan.autoid=ppid'] ) """ for item in p_list: qtreeitem = QTreeWidgetItem(current_tree) qtreeitem.setText(0, str(item['autoid'])) qtreeitem.setText(1, SOURCE[item['pisource']]) qtreeitem.setText(2, item['prodid'] + ' ' + item['prodname']) qtreeitem.setText(3, item['commonname']) if item['pisource'] == 2: key_dict = {'autoid': item['hxid']} hx_batchno_list = self.PC.get_producingplan( True, *VALUES_TUPLE_PRODUCINGPLAN, **key_dict ) hx_batchno = '' if len(hx_batchno_list): hx_batchno = hx_batchno_list[0] qtreeitem.setText(4, item['batchno'] + ' ' + hx_batchno) qtreeitem.setText( 7, to_str((item['piamount'] - item[ 'hxamount'])) + '+' + to_str(item['hxamount']) ) qtreeitem.setText( 8, to_str(item['stockamount'] - item[ 'hxstockamount']) + '+' + to_str(item['hxstockamount']) ) else: qtreeitem.setText(4, item['batchno']) qtreeitem.setText(7, str(item['piamount'])) qtreeitem.setText(8, str(item['stockamount'])) qtreeitem.setText(5, item['spec']) qtreeitem.setText(6, item['package']) qtreeitem.setText(9, item['spunit']) qtreeitem.setText(10, item['position']) qtreeitem.setText(11, str(item['indate'])) if type(item['makedate']) is datetime.date: qtreeitem.setText(12, str(item['makedate'])) qtreeitem.setText(13, str(item['expireddate'])) qtreeitem.setText( 14, item['warehousemanid'] + item['warehousemanname'] )
def get_detail(self): key_dict = {'autoid': self.autoid} stuff_list = self.SC.get_prodstuff(False, *VALUE_TUPLE_STUFF, **key_dict) if not len(stuff_list): self.pushButton_accept.setVisible(False) self.pushButton_cancel.setVisible(False) return self.ori_detail = stuff_list[0] self.label_stuff.setText(self.ori_detail['stuffid'] + ' ' + self.ori_detail['stuffname']) self.label_drawamount.setText( to_str(self.ori_detail['drawamount']) + \ self.ori_detail['drawunit'] ) self.lineEdit_pracamount.setText(to_str(self.ori_detail['pracamount'])) self.label_realunit.setText(self.ori_detail['drawunit']) self.lineEdit_restamount.setText(to_str(self.ori_detail['restamount'])) self.label_restunit.setText(self.ori_detail['drawunit']) self.lineEdit_backamount.setText(to_str(self.ori_detail['backamount'])) self.label_backunit.setText(self.ori_detail['drawunit'])
def get_detail(self): key_dict = {'autoid': self.autoid} detail_list = self.SC.get_salenotegoods(False, *VALUES_TUPLE_PROD, **key_dict) if not len(detail_list): return self.ori_detail = detail_list[0] self.lineEdit_product.setText(self.ori_detail['prodid'] + ' ' + self.ori_detail['prodname']) self.label_spec.setText(self.ori_detail['spec']) self.label_package.setText(self.ori_detail['package']) self.lineEdit_amount.setText(to_str(self.ori_detail['saleamount'])) self.label_unit.setText(self.ori_detail['spunit'])
def get_detail(self): key_dict = {'autoid': self.autoid} res = self.PC.get_producingplan(False, *VALUES_TUPLE_PP, **key_dict) if not len(res): return pp_detail = res[0] self.label_product.setText(pp_detail['prodid'] + pp_detail['prodname']) self.label_commonname.setText(pp_detail['commonname']) self.label_spec.setText(pp_detail['spec']) self.label_package.setText(pp_detail['package']) self.label_batchno.setText(pp_detail['batchno']) self.label_realamout.setText( to_str(pp_detail['realamount']) + pp_detail['spunit'] ) self.label_makedate.setText(str(pp_detail['makedate']))
def set_kind_tree(self, current_tree, product_list): kind_list = product_list.values(*VALUES_TUPLE_KIND).annotate( stockamount=Sum('stockamount'), piamount=Sum('piamount') ) """ .extra( select={ 'prodid': 'prodid', 'prodname': 'prodname', 'spec': 'spec', 'commonname': 'commonname', 'package': 'package', 'spunit': 'spunit' }, tables=['producingplan'], where=['producingplan.autoid=ppid'] ). \ """ for item in kind_list: qtreeitem = QTreeWidgetItem(current_tree) qtreeitem.setText(0, item['prodid'] + item['prodname']) qtreeitem.setText(1, item['commonname']) qtreeitem.setText(2, item['spec']) qtreeitem.setText(3, item['package']) qtreeitem.setText(4, to_str(item['piamount'])) qtreeitem.setText(5, to_str(item['stockamount'])) qtreeitem.setText(6, item['spunit'])
def get_putinnote(self): key_dict = {'autoid': self.autoid} res = self.WC.get_productputinnote(False, *VALUES_TUPLE_PUTIN, **key_dict) if not len(res): return # 选择第一条 self.ori_detail = res[0] self.label_warehouse.setText(self.ori_detail['warehouseid'] + ' ' + self.ori_detail['warehousename']) self.comboBox_piposition.setCurrentText(self.ori_detail['position']) self.pushButton_applyer.setText(self.ori_detail['piapplyerid'] + ' ' + self.ori_detail['piapplyername']) self.pushButton_qa.setSign( True, self.ori_detail['piqaid'] + ' ' + self.ori_detail['piqaname']) self.pushButton_piwsman.setSign( True, self.ori_detail['warehousemanid'] + ' ' + self.ori_detail['warehousemanname']) self.lineEdit_amount.setText(to_str(self.ori_detail['piamount'])) if self.ori_detail['pistatus'] == 0: self.pushButton_accept.setVisible(True) self.pushButton_save.setVisible(True) self.pushButton_cancel.setVisible(False) self.pushButton_pi.setVisible(False) elif self.ori_detail['pistatus'] == 1: self.pushButton_accept.setVisible(False) self.pushButton_save.setVisible(False) self.pushButton_cancel.setVisible(True) self.pushButton_pi.setVisible(True) elif self.ori_detail['pistatus'] == 3: self.pushButton_accept.setVisible(False) self.pushButton_save.setVisible(False) self.pushButton_cancel.setVisible(False) self.pushButton_pi.setVisible(False)